Project

General

Profile

Actions

Question #11261

closed

Double-ampersand is not an "empty template variable"

Added by Dmitry Svyatogorov over 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
N/A
Assignee:
-
Category:
Techniques
Target version:
Regression:

Description

While writing technique template (*.st), currently it is impossible to use "&&", e.g. in implementation of shell commands.
Writing something like

    commands:
    plugin_exist::
        "${rabbitmqpl} list -m -e ^${pluginName}$ | /bin/grep -q ${pluginName} && /bin/echo '+Enabled'" 

leads to error in generating promises from such directive.
Looks like Rudder assumes that two ampersands are always quoting template varialbes. But "&&" is just "&&", not an empty template entry.
(And single ampersand may although be needed in shell scripting.)

On the opposite, the following code works ok:

    commands:
    plugin_exist::
        "${rabbitmqpl} list -m -e ^${pluginName}$ | /bin/grep -q ${pluginName} || /bin/echo '+notEnabled'" 

(?) M.b. there is the way to correctly escape "&" to bypass it inside promise?

Actions

Also available in: Atom PDF