Ask Your Question

exec resource previous_value is always notrun

asked 2018-07-23 11:44:45 -0600

ilvidel gravatar image

updated 2018-07-25 03:06:03 -0600

I have a couple of exec resources, one of which has a onlyif stanza. In the reports and Puppetboard, both of them show up always as _changed_ because their previous_value is always notrun. This doesn't make any sense, specially for the one without an onlyif (it is run every time).

Is this a bug? What can I do to fix this?

EDIT: Adding the code, and log output

exec { 'make-plugins-executable':
  command => "/usr/bin/chmod a+x ${pluginsdir}/check*",
  require => File['plugins']

exec { 'nagios-permissions':
  command => "/usr/bin/chown -R nagios:nagios ${confdir}",
  onlyif  => "/usr/bin/test ! -z \"/usr/bin/find ${confdir} ! -user nagios -o ! -group nagios\""

Note: I realize that find always returns 0, whether it finds any file or not. Fixing that makes it run only when it should. However, that is a different subject.

Also, this is the output in the log:

2018-07-23 11:40:48 +0100 /Stage[main]/Bcc_nagios/Exec[make-plugins-executable]/returns (notice): executed successfully
2018-07-23 11:40:48 +0100 /Stage[main]/Bcc_nagios::Master/Exec[nagios-permissions]/returns (notice): executed successfully
2018-07-23 11:40:58 +0100 Puppet (notice): Applied catalog in 10.09 seconds

They get run, but they show up as notrun in last_run_summary.yaml

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-24 11:48:14 -0600

binford2k gravatar image

You'll have to share more code to explain what's happening in your particular circumstance. But in general, an exec will run every single time Puppet runs unless you gate it yourself, via creates, unless, onlyif, or refreshonly. See for more info.

edit flag offensive delete link more


Hi, thanks for your response. Sorry, I may not have explained it properly: the problem is not that they are run every time. The problem is that, although they are run, `last_run_summary.yaml` reports them as `notrun`, and therefore, Puppetboard shows them as `changed`. I will update the question.

ilvidel gravatar imageilvidel ( 2018-07-25 03:01:43 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-07-23 11:38:48 -0600

Seen: 192 times

Last updated: Jul 25