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

Option for variable expansion when setting environment variables #6

Closed

Conversation

akamike
Copy link

@akamike akamike commented Dec 5, 2013

This PR adds an expand option to magic_shell_environment to switch the quotes from single to double, so variables within value can be expanded. An example of where this might be useful is setting $PATH, previously a value of "/my/custom/path:$PATH" would not be expanded.

I made this an option rather than simply replacing the quotation directly as some existing users may depend on the lack of expansion.

@sethvargo
Copy link
Contributor

I'm 👎. Even though "$PATH" doesn't get expanded to it's value, the env will read it that way in the end.

@akamike
Copy link
Author

akamike commented Dec 5, 2013

I'm not sure I understand, although I am not the most knowledgeable in this area so I may be missing a trick. My apologies in advance if this is the case.

Adding PATH through magic_shell_environment (without this PR) would result in the file /etc/profile.d/PATH.sh containing export PATH='/my/path:$PATH' - meaning $PATH would not be expanded by the env? It would have to be export PATH="/my/path:$PATH" or export PATH=/my/path:$PATH for that to happen?

@sethvargo
Copy link
Contributor

Ah yea. You're right

sethvargo added a commit that referenced this pull request Jan 19, 2014
-  Refactor providers to support whyrun mode
-  Package custom ChefSpec matchers
-  Add Test Kitchen integration test
-  Update ChefSpec tests
-  Expand environment variables (like `$PATH`) (#6)
-  Add Rakefile for running tests
-  Use the latest and greatest testing strategies
@sethvargo sethvargo closed this in 15979e7 Jan 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants