-
-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rvm_shell not setting environment variables on system install #69
Comments
👍 Also seeing this issue here. |
Is this still an issue? |
Yes, this is still an issue in 0.9.2 and master (0.10.1). Tested with chef-client 11.10.4. |
Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
I am using the system based install and no individual user rvm. I am trying to run a command that depends on the correct HOME environment variable being set as the user running the command. However, I am finding $HOME is set to the home of the user running the chef-client command. For example:
rvm_shell "a command" do
code "echo $HOME > /tmp/env.txt"
user "chris"
end
then suppose I start my chef-client run with rvmsudo as user "ubuntu"
this command will output with the text "/home/ubuntu", when I would expect it to be "/home/chris".
So I dug into the code and modified providers/shell.rb and changed lines 80-85 to:
if new_resource.user && new_resource.environment
environment({ 'USER' => new_resource.user, 'HOME' => user_home }.merge(
new_resource.environment))
elsif new_resource.user
environment({ 'USER' => new_resource.user, 'HOME' => user_home })
end
Anyhow, I'm not sure if that is the correct fix, but it did the trick for me.
-Chris
The text was updated successfully, but these errors were encountered: