-
Don't use
execwithoutuserparameterIf you use
execwithoutuserparameter, the command will get executed as root. You mostly don't want this. -
There is a difference in the env variables of the exec if you run puppet manually or if the daemon runs.
-
Never ever use
execwithoutcwdparameterIf you use
execwithoutcwdparameter, the command get executed in the cwd of your puppet run. This can cause problems if you run the puppet agent manually.Example:
# exec resource: exec { "update_rubygems_${user}_${version}": command => "${home}/.rbenv/shims/gem update --system ${version}", unless => "${home}/.rbenv/shims/gem -v | /bin/grep ${version}", }This does execute rbenv commands. If puppet runs in a cwd without
.rbenv-versionit's no problem it uses the default ruby version. If you are in a cwd with a.ruby-versionit uses the ruby version from this file for all rbenv commands. You will probably get some errors.