When trying to use the
rvmsudo puppet apply --verbose manifests/site.pp
command in a aws instance to follow the instruction from ‘Deploying Rails’, the following error complains that the puppet command is not found, like:
sudo: puppet: command not found
After some searching and having a look at the blog post here and using the rvm notes in the aws instance and looking at this:
* On some systems (like Ubuntu) rvmsudo requires following changes to work properly: http://stackoverflow.com/questions/257616/sudo-changes-path-why
It seems that for security reason the sudo command resets the path in the system.
You can actually see that this the case by running the command to display the path of the normal user:
aws$ echo 'echo $PATH' | sh
and the corresponding one for the sudo:
aws$ echo 'echo $PATH' | sudo sh
So a workaround to make it work is to add your group into the exemptions group in the visudo file, which means editing the visudo file:
sudo visudo
and adding the group that your user you are working with belongs to:
Defaults env_reset Defaults exempt_group=name_of_your_group(or admin in some systems)