Skip to content
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

Closed
cswilliams opened this issue Jan 26, 2012 · 5 comments
Closed

rvm_shell not setting environment variables on system install #69

cswilliams opened this issue Jan 26, 2012 · 5 comments
Labels
Bug Something isn't working

Comments

@cswilliams
Copy link

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

@nhance
Copy link

nhance commented Sep 27, 2012

👍 Also seeing this issue here.

@cmluciano
Copy link
Contributor

Is this still an issue?

@karlsvec
Copy link

Yes, this is still an issue in 0.9.2 and master (0.10.1). Tested with chef-client 11.10.4.

@cmluciano cmluciano added Bug Something isn't working and removed Pending Feedback labels Mar 27, 2015
@damacus
Copy link
Member

damacus commented May 31, 2019

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,
Sous-Chefs

@damacus damacus closed this as completed May 31, 2019
@lock
Copy link

lock bot commented Jun 24, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants