On 9/4/2013 9:01 AM, Vladimir Brik wrote:
Hello,
I have noticed that commands specified in 'onlyif' and 'unless'
parameters of the Exec type are always executed, even if --noop option
is given on command line or the resource's noop parameter is set to true.
For example, the following block always creates /tmp/onlyif and
/tmp/unless.
exec{"touch /tmp/exec":
noop => true,
onlyif => "touch /tmp/onlyif",
unless => "touch /tmp/unless; false",
}
Is this expected behavior?
Personally I would expect that behavior.
When I use "--noop" I expect puppet to tell me what it would do without
the flag, and it is necessary for it to execute predicates in order to
determine that.
I would no more expect it not to execute the predicate procedures in an
"exec" than I would expect it not to execute the custom fact procedures
when executing facter (or expect it not to execute facter).
I consider predicates which modify the state of the system to be
violating the contract of "predicate". I don't expect puppet to work
around this kind of contract violation, particularly when doing so would
reduce the value to me.
I.e. I would expect to write
# NOTE: example that ignores a lot of resiliency
exec { "echo %sudo ALL ALL >> /etc/sudoers":
onlyif => "grep -v %sudo /etc/sudoers"
}
and if I execute it with the "--noop" flag I would expect it to tell me
whether or not it would modify /etc/sudoers if I ran it without the flag.
--
Dewey
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.