Ask Your Question

Does the exec resource type only use its path=> attribute with the command=> attribute, or can the exec resource type also use its path=> attribute for the onlyif=> part?

asked 2015-09-10 17:38:19 -0600

NathanBasanese gravatar image

updated 2015-09-10 17:46:49 -0600

For example:

exec {"stuff_update":
 onlyif => "test -f /etc/init.d/stuff",
 user => "root",
 timeout => 0,


In the above declaration for the exec resource type, does the above command test -f /etc/init.d/stuff have its executable path set by the path=> attribute?

That is, would test -f /etc/init.d/stuff run with the path /usr/local/bin/:/bin/?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-09-11 06:43:35 -0600

Hi path used just for command execution and onlyif.

e.g. a simple class:

class nattest {
   exec {"nattest":
      command     => "/bin/date",
      onlyif           => "grep root /etc/passwd",


running puppet apply nattest.pp give error 'grep root is not qualified'

to fix this either need to add fully qualified command (i.e. /bin/grep) or:

path => "/bin:/usr/bin" to class

so yes - path is used by exec and onlyif

Cheers Stuart

edit flag offensive delete link more

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: 2015-09-10 17:38:19 -0600

Seen: 442 times

Last updated: Sep 11 '15