On 24/06/2011 20:19, Aleksey Tsalolikhin wrote:
>
>      commands:
>
>         "/usr/bin/pecl install fileinfo"
>
>               ifnotfunc =>  fileexists("/usr/lib64/php/modules/fileinfo.so");

You could simply do :

classes:
   "fileinfo_to_install" not => 
fileexists("/usr/lib64/php/modules/fileinfo.so");

commands:
fileinfo_to_install::
     "/usr/bin/pecl install fileinfo";


or also
commands:
     "/usr/bin/pecl install fileinfo"
         ifvarclass => "fileinfo_to_install";

>
> That would only run the command if the fileexists function returns
> false.  Very concise and powerful expression of the sysadmin's
> intention, all in a single promise.
>

It's not so easy to understand promises with ifvarclass, i'm afraid 
having ifnotfunc also would cause more headaches. I like the idea of 
doing something only if a class is set, it shows more the step involved 
to reach a state, but that's my two cents

Regards

Nicolas
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to