help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shellcommands returns 256, not 0


From: Brendan Strejcek
Subject: Re: shellcommands returns 256, not 0
Date: Mon, 19 Apr 2004 19:09:26 -0500
User-agent: Mutt/1.3.28i

David Kewley wrote:

> It seems you can't do:
> 
>   control:
> 
>     etc_dir = ( "/etc" )
> 
>   classes:
> 
>     have_etc = ( IsDir($(etc_dir)) )
> 
> I tried that and also using IsDir("$(etc_dir)").  Neither worked; the class 
> never got defined.  IsDir(/etc) worked fine.

classes/groups is not a normal action (it should not appear in your
actionsequence). I happens before everything else (I forget why, but I
think there is a good reason). When the classes are evaluated, it has
not yet looked at the control section.

If you want a slightly more elegant style than shellcommands with &&, you
can do something like the following:

    shellcommands:

        any::

            "${test} -d ${dir}" define=is_dir

        is_dir::

            "/something/to/do/if/is/dir"

That is rather readable and seems to fit the cfengine paradigm while
preserving your order.

The problem with this is that you see lots of shellcommands in inform
mode which can obfuscate what is actually going on.

Maybe you can do something with the files action and a define.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]