The following code inside bin/puppet does not work:
# If noop is set, then also enable diffs
if Puppet[:noop]
Puppet[:show_diff] = true
end
or more correctly, it does, but unless --show_diff is specified explicitly, it gets reset to false just a few lines later, during :
Puppet.settings.parse(Puppet[:config])
I verified this by inserting some debugging statements in a few points along the code path.
$ puppet --noop --diff_args -u manifests/site.pp
notice: SHOW DIFF is true after setting the option
notice: SHOW DIFF is true before settings.parse
notice: SHOW DIFF is false after settins.parse
[...]
$ puppet --noop --show_diff --diff_args -u manifests/site.pp
notice: SHOW DIFF is true after setting the option
notice: SHOW DIFF is true before settings.parse
notice: SHOW DIFF is true after settins.parse
[...]
Moving the bit of code mentioned at the begining of the ticket to a point after Puppet.settings.parse is called fixes the issue for me.