Hi,

yes this was only an example. The point was to demonstrate the cf-engine
bug, I know that the example I wrote is stupid. Shall I report it to the bug
mailing list (I think yes)?

2009/12/4 <nwat...@symcor.com>

> You might try some negative testing on your shell command before you
> integrate it with CF.  I don't think that the return values are what you
> expect.
> nwat...@tofrcpl58903 ~/cfengine $ echo $(cat /etc/hosts)
>  127.0.0.1 localhoste.com # x client hosterver by a '#' symbol.dividuale.
> nwat...@tofrcpl58903 ~/cfengine $ echo $?
> 0
> nwat...@tofrcpl58903 ~/cfengine $ echo $(cat /etc/foobar)
> cat: /etc/foobar: No such file or directory
>
>


OK. I realized your example works fine. However the following one definitely
does not:


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

bundle common g{
   vars:
       "masterfiles" string => "/var/cf-masterfiles";
       "inputs" string => "${masterfiles}/config/inputs";
       "workdir" string => "/var/cfengine";

# Duplicate phost rules in update.cf
       "phost" string => "unxxhd01.symprod.com";
}


bundle agent test {
classes:
        "MyClass" expression => returnszero("/bin/echo ${const.dollar}(cat
/etc/hosts)", "useshell");


}

body contain use_shell { useshell => "true"; }

So it appears the problem is with the use of returnszero (it may also fail
with execresult, did not try yet).

nwat...@tofrcpl58903 ~/cfengine $ echo $?
> 0
>
> Sincerely,
> --
> Neil Watson
> 416-673-3465
>
>
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to