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:
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: