thierry thunot <tth...@gmail.com> writes:
Hello everyone, I have a little problem with Cf. I want to use parameterized variables to create classes more easily .. I tested this for apache masi it is the philosophy that interests me to do this kind of test
> > classes: > "module_\){liste_module_apache}_nok" expression =>bundle agent configuration_test_apache { vars: "liste_module_apache" slist => {"rewrite","ssl","session"}; "test_module_${liste_module_apache}_apache" string => execresult("/usr/sbin/apache2ctl -M|grep \({liste_module_apache}","noshell");
strcmp("\({test_module_\){liste_module_apache}_apache}",""); reports: module_${liste_module_apache}_nok:: "MODULE APACHE ${liste_module_apache} pas présent";
}Can you advise me on the best way to proceed? Thank's !!! ;)
Hi Thierry
Not sure what specifically you are looking for, but on a quick scan of your policy:
I don't believe that you can pipe inside an execresult()
without using a shell.
execresult("/usr/sbin/apache2ctl -M|grep ${liste_module_apache}","noshell");
Also, I don't think it applies to apache modules since I don't think there are any whose names contain invalid class characters (e.g. -
), but if you are creating classes from arbitrary strings, you should canonify()
when checking.
"MODULE APACHE ${liste_module_apache} pas présent" if => canonify( ${liste_module_apache} );
And finally, you must quote a variable class expression, again, beware if any liste_module_apache
entry contains any characters that are not valid in a class name, this won't work.
--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/fb1c2ea7-dba9-4e11-a4d7-5a029b391c85n%40googlegroups.com.