Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

VAGRANT_VAGRANTFILE env var to specify alternate filename for Vfile

  • Loading branch information...
commit 499d1ff8bf83531cfddc97a100881b1398b4a422 1 parent 1bda157
Mitchell Hashimoto mitchellh authored
2  CHANGELOG.md
View
@@ -38,6 +38,8 @@ FEATURES:
VirtualBox provider config. [GH-1126]
- `vagrant ssh` will execute an `ssh` binary on Windows if it is on
your PATH. [GH-933]
+ - The environmental variable `VAGRANT_VAGRANTFILE` can be used to
+ specify an alternate Vagrantfile filename.
IMPROVEMENTS / BUG FIXES:
6 lib/vagrant/environment.rb
View
@@ -81,11 +81,11 @@ def initialize(opts=nil)
# Set the Vagrantfile name up. We append "Vagrantfile" and "vagrantfile" so that
# those continue to work as well, but anything custom will take precedence.
- opts[:vagrantfile_name] ||= []
+ opts[:vagrantfile_name] ||= ENV["VAGRANT_VAGRANTFILE"] if \
+ ENV.has_key?("VAGRANT_VAGRANTFILE")
+ opts[:vagrantfile_name] ||= ["Vagrantfile", "vagrantfile"]
opts[:vagrantfile_name] = [opts[:vagrantfile_name]] if \
!opts[:vagrantfile_name].is_a?(Array)
- opts[:vagrantfile_name] = ["Vagrantfile", "vagrantfile"] if \
- opts[:vagrantfile_name].empty?
# Set instance variables for all the configuration parameters.
@cwd = opts[:cwd]
15 test/unit/vagrant/environment_test.rb
View
@@ -284,6 +284,21 @@
env.config_global.ssh.port.should == 200
end
+ it "should load from a custom Vagrantfile specified by env var" do
+ environment = isolated_environment do |env|
+ env.file("some_other_name", <<-VF)
+Vagrant.configure("2") do |config|
+ config.ssh.port = 400
+end
+VF
+ end
+
+ env = with_temp_env("VAGRANT_VAGRANTFILE" => "some_other_name") do
+ environment.create_vagrant_env
+ end
+
+ env.config_global.ssh.port.should == 400
+ end
end
describe "ui" do
Please sign in to comment.
Something went wrong with that request. Please try again.