Packaging uses MAC address directly from the machine

This commit is contained in:
Mitchell Hashimoto 2010-04-12 16:12:37 -07:00
parent 40e823d90a
commit 677b3b05cc
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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)