Details
-
Improvement
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Night's Watch
-
1
-
NW - 2021-08-11
-
Enhancement
-
Document {{noop}} behavior of {{onlyif}} and {{unless}} parameters of the {{exec}} resource. (not sure if this should make the release notes)
-
Needs Assessment
Description
Taken from: https://groups.google.com/g/puppet-users/c/axT5CfVNDXU
The noop flag tells Puppet to determine which resources are out of sync, and to report them without actually synchronizing them. The 'onlyif' and 'unless' commands of an Exec are used in the process of determining whether the Exec is already in sync, therefore they must be run during a -noop Puppet run. The synchronization of an out-of-sync Exec resource involves only running the command given by its 'command' property, so that's the only part that -noop prevents.
Up until https://github.com/puppetlabs/puppet/commit/c127bcb1f6b3d0a0e7b9122352162528fbb65b6c onlyif and unless commands did not run in the specified cwd, which might have given the wrong impression that noop also applies to those parameters. Applying something like the following manifest would have worked prior to that commit:
exec { "hello world":
|
cwd => '/home/gabi/tmp/abc',
|
command => "/bin/echo hello world",
|
onlyif => "/bin/test -e asd",
|
}
|
After puppet 5.5.7 applying the manifest above with --noop fails with the following error (provided that the cwd does not exist):
Error: /Stage[main]/Main/Exec[hello world]: Could not evaluate: Working directory /home/gabi/tmp/abc does not exist!
|
This is expected behavior since noop does not prevent onlyif and unless from being run. We should document this behavior.
Attachments
Issue Links
- relates to
-
PUP-9997 Puppet must not call Dir.chdir() except in a child process
-
- Accepted
-