diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 78a7c454b..b9967de74 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -295,6 +295,8 @@ module Vagrant output = nil if ENV["VAGRANT_LOG"] == "STDOUT" output = STDOUT + elsif ENV["VAGRANT_LOG"] == "NULL" + output = nil elsif ENV["VAGRANT_LOG"] output = ENV["VAGRANT_LOG"] else @@ -431,9 +433,23 @@ module Vagrant @config_loader.set(:default, File.expand_path("config/default.rb", Vagrant.source_root)) vagrantfile_name.each do |rootfile| - @config_loader.set(:box, File.join(box.directory, rootfile)) if !first_run && vm && box - @config_loader.set(:home, File.join(home_path, rootfile)) if !first_run && home_path - @config_loader.set(:root, File.join(root_path, rootfile)) if root_path + if !first_run && vm && box + # We load the box Vagrantfile + box_vagrantfile = box.directory.join(rootfile) + @config_loader.set(:box, box_vagrantfile) if box_vagrantfile.exist? + end + + if !first_run && home_path + # Load the home Vagrantfile + home_vagrantfile = home_path.join(rootfile) + @config_loader.set(:home, home_vagrantfile) if home_vagrantfile.exist? + end + + if root_path + # Load the Vagrantfile in this directory + root_vagrantfile = root_path.join(rootfile) + @config_loader.set(:root, File.join(root_path, rootfile)) if root_vagrantfile.exist? + end end # If this environment is representing a sub-VM, then we push that diff --git a/test/test_helper.rb b/test/test_helper.rb index 93bb8fc62..fcfdaf9d5 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -16,6 +16,9 @@ end # Set the home directory to some temporary directory ENV["HOME"] = Vagrant.source_root.join("test", "tmp", "home").to_s +# Set the log output to nothing +ENV["VAGRANT_LOG"] = "NULL" + # Add the I18n locale for tests I18n.load_path << File.expand_path("../locales/en.yml", __FILE__) diff --git a/test/vagrant/environment_test.rb b/test/vagrant/environment_test.rb index 89d4c3337..a309b52a7 100644 --- a/test/vagrant/environment_test.rb +++ b/test/vagrant/environment_test.rb @@ -525,11 +525,6 @@ class EnvironmentTest < Test::Unit::TestCase assert_equal "set", @env.vms[:web].env.config.vm.base_mac end - should "reload the logger after executing" do - @env.load_config! - assert @env.instance_variable_get(:@logger).nil? - end - should "be able to reload config" do vagrantfile(@env.root_path, "config.vm.box = 'box'")