diff --git a/lib/vagrant/actions/vm/package.rb b/lib/vagrant/actions/vm/package.rb index 5e405c244..b0b25e523 100644 --- a/lib/vagrant/actions/vm/package.rb +++ b/lib/vagrant/actions/vm/package.rb @@ -57,7 +57,7 @@ module Vagrant def create_vagrantfile File.open(File.join(temp_path, "Vagrantfile"), "w") do |f| f.write(TemplateRenderer.render("package_Vagrantfile", { - :base_mac => @runner.env.config.vm.base_mac + :base_mac => @runner.vm.network_adapters.first.mac_address })) end end diff --git a/test/vagrant/actions/vm/package_test.rb b/test/vagrant/actions/vm/package_test.rb index 588bbd23c..27b7f4e80 100644 --- a/test/vagrant/actions/vm/package_test.rb +++ b/test/vagrant/actions/vm/package_test.rb @@ -91,6 +91,10 @@ class PackageActionTest < Test::Unit::TestCase setup do @temp_path = "foo" @action.stubs(:temp_path).returns(@temp_path) + + @network_adapter = mock("nic") + @network_adapter.stubs(:mac_address).returns("mac_address") + @vm.stubs(:network_adapters).returns([@network_adapter]) end should "write the rendered vagrantfile to temp_path Vagrantfile" do @@ -98,7 +102,7 @@ class PackageActionTest < Test::Unit::TestCase rendered = mock("rendered") File.expects(:open).with(File.join(@action.temp_path, "Vagrantfile"), "w").yields(f) Vagrant::Util::TemplateRenderer.expects(:render).returns(rendered).with("package_Vagrantfile", { - :base_mac => @runner.env.config.vm.base_mac + :base_mac => @runner.vm.network_adapters.first.mac_address }) f.expects(:write).with(rendered)