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: Christian Pearce
Subject: Re: shellcommands returns 256, not 0
Date: Mon, 19 Apr 2004 20:30:55 GMT

I would suggest using groups

IsDir(f)
    True if the named file object is a directory. 

http://www.cfengine.org/docs/cfengine-Reference.html#Evaluated%20classes%20and%20special%20functions


--
Christian Pearce
http://www.commnav.com



David Kewley said:
> 
> I can probably find a hack to work around this, but I wonder if anyone else 
> has seen this and can suggest a clean solution?
> 
> I'm running cfengine on RHL 9.  I am running a pair of shellcommands like 
> this:
> 
> shellcommands:
> 
>       work::
> 
>               "/usr/bin/test -d $(host_keys_master_dir)"
> 
>                       owner=$(private_owner)
>                       group=$(private_group)
>                       inform=false
>                       useshell=true
>                       define=have_host_keys_master
> 
>       work.have_host_keys_master::
> 
>               "/usr/bin/diff -qr $(host_keys_master_dir) $(host_keys_workdir) 
> && /bin/cp 
> -a $(host_keys_master_dir)/* $(host_keys_workdir)"
> 
>                       owner=$(private_owner)
>                       group=$(private_group)
>                       useshell=true
> 
> The reason I'm doing a shellcommands 'cp' instead of a copy: is that I need 
> the copy to be done as a non-root user, but cfengine is run as root.
> 
> Anyway, the problem I'm now seeing is that although the first shellcommand 
> (/usr/bin/test) gives a return value of 0 when run in bash, it returns 256 
> when run by cfengine.  cfengine interprets this as a failure (non-zero), so 
> does not do the 'define', and the second shellcommand is not executed.
> 
> I've seen this before and found a way to work around it, but it was a hack.  
> Does anyone know how to deal with this cleanly?  Is this a bug somewhere, or 
> expected behavior?  What does return code 256 indicate?
> 
> Thanks,
> David
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine
>




reply via email to

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