Hello, I discussed this issue in the help ML before but it really appears
like it is a bug.

Basically, cf-engine chokes on ${const.dollar}( ... ) in command strings
passed to returnszero function. However $() in a shell (Bash) can be very
useful as it triggers a subshell. There is a bug in the parser somewhere as
this example demonstrates:

body common control
{
    bundlesequence => {"configurePhase"};
}

bundle agent configurePhase
{
        classes:
                "MyClass" expression => returnszero("/bin/echo
${const.dollar}(cat /etc/hosts)", "useshell");
                "MyClass2" expression => returnszero("/bin/echo `cat
/etc/hosts`", "useshell");
        reports:
        MyClass::
                "Hi World";
        MyClass2::
                "Hello World";
}


MyClass2 will correctly be defined, but not MyClass as cf-engine will refuse
to run the first command - the parser gets confused and attempts to solve
'cat /etc/hosts' as a variable it seems. I checked this on today's SVN and
the problem is still present. Please correct it :)

Cheers
Jean-Noel
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to