AcceptanceIsolatedEnvironment - add attr_accessor for :env to allow setting custom env vars#17
Open
jantman wants to merge 1 commit intohashicorp:mainfrom
Open
AcceptanceIsolatedEnvironment - add attr_accessor for :env to allow setting custom env vars#17jantman wants to merge 1 commit intohashicorp:mainfrom
jantman wants to merge 1 commit intohashicorp:mainfrom
Conversation
…etting custom env vars that may include homedir or workdir
jantman
added a commit
to jantman/vagrant-r10k
that referenced
this pull request
May 15, 2015
…ted environments sharing VBox config; see hashicorp/vagrant-spec#17
|
I had a similar issue when upgrading vagrant-spec for vagrant-dns. Here is what I did: # vagrant-spec.config.rb
Vagrant::Spec::Acceptance.configure do |c|
# ...
c.instance_variable_set(:@env, c.env.merge('VBOX_USER_HOME' => "{{homedir}}"))
endThe It would nice to convert the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As I mentioned in #15, I was having serious issues with specs that actually run
vagrant addandvagrant upand spin up a VirtualBox VM. It seems that VirtualBox was storing state between spec runs, which caused failures (VBox was dying with errors trying to read aVirtualBox.xml-tmpunder a tmpdir from a previous spec).This just adds an attr_accessor for
envin AcceptanceIsolatedEnvironment, which allows setting environment variables after creation. These could be things like API credentials, or in my case (to solve the VirtualBox issue),environment.env['VBOX_USER_HOME'] = environment.homedir.to_s.Essentially, this allows setting environment variables to values not known until after the IsolatedEnvironment is instantiated, such as values which include or are based on the tempdir path.