About | FAQ | Help
Ask Your Question

Revision history [back]

The noop setting of a resource has a higher priority than the general noop agent setting, so if you specify noop => true at the resource level, the resource will always apply with noop.

One option I can think of is using the fact that an environment setting FACTER_foo will become the fact foo in facter. So you can write your manifest like:

$exec_noop => $::apply_dangerous_settings ? {
  'y'     => undef,
  default => true,
}

exec { 'echo foo':
  noop => $exec_noop,
}

if you now run your agent as puppet agent -t the noop setting will be true so you will never run the dangerous code. But if you run your agent like

FACTER_apply_dangerous_settings=y puppet agent -t

the noop setting of your exec resource will be undef, so the global noop setting will be used (which defaults to false).