On 12/13/2010 05:40 PM, Sandor Szuecs wrote:
> Hi,
> 
> I need to run an exec ressource if one of the conditions fail.
> It seems not to work from puppet versions 0.25.4 to 2.6.4.
> 
> # 1. try onlyif:
> % puppet -e ' Exec { path => "/usr/bin:/bin:/usr/sbin:/sbin" }
> exec { "run_rsn":
>       command => "touch /bar",
>       onlyif => [ "test -f /does_not_exist", "test -d /"]}'
> 
> 
> # 2. try unless:
> % puppet -e ' Exec { path => "/usr/bin:/bin:/usr/sbin:/sbin" }
> exec { "run_rsn":
>       command => "touch /bar",
>       unless => [ "test -f /does_not_exist", "test -d /"]}'
> 
> % ls /bar                                        
> ls: cannot access /bar: No such file or directory
> zsh: exit 2
> 
> Any hints or ideas or better bugreport or maybe it is a known bug?

Am I right to assume that
test -f /does_not_exist *always* returns 1 and
test -d / *always* returns 0?

If so, I don't see the problem ;/
Either both pass (onlyif) or both fail (unless).
Use "test -f /does_not_exist || test -d /" to accept either one passing.

Regards,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to