diff --git a/config/default.rb b/config/default.rb index 74e8ee2f7..bac1a6f0a 100644 --- a/config/default.rb +++ b/config/default.rb @@ -15,7 +15,6 @@ Vagrant::Config.run do |config| config.ssh.forward_x11 = false config.vm.auto_port_range = (2200..2250) - config.vm.box_ovf = "box.ovf" config.vm.box_url = nil config.vm.base_mac = nil config.vm.forward_port("ssh", 22, 2222, :auto => true) diff --git a/lib/vagrant/action/box/unpackage.rb b/lib/vagrant/action/box/unpackage.rb index 31f05c8e1..0f2f3ebd8 100644 --- a/lib/vagrant/action/box/unpackage.rb +++ b/lib/vagrant/action/box/unpackage.rb @@ -37,16 +37,18 @@ module Vagrant end def setup_box_directory - raise Errors::BoxAlreadyExists, :name => @env["box"].name if File.directory?(@env["box"].directory) + if File.directory?(@env["box_directory"]) + raise Errors::BoxAlreadyExists, :name => @env["box_name"] + end - FileUtils.mkdir_p(@env["box"].directory) - @box_directory = @env["box"].directory + FileUtils.mkdir_p(@env["box_directory"]) + @box_directory = @env["box_directory"] end def decompress - Dir.chdir(@env["box"].directory) do - @env.ui.info I18n.t("vagrant.actions.box.unpackage.extracting") - Archive::Tar::Minitar.unpack(@env["download.temp_path"], @env["box"].directory.to_s) + Dir.chdir(@env["box_directory"]) do + @env[:ui].info I18n.t("vagrant.actions.box.unpackage.extracting") + Archive::Tar::Minitar.unpack(@env["download.temp_path"], @env["box_directory"].to_s) end end end diff --git a/lib/vagrant/action/box/verify.rb b/lib/vagrant/action/box/verify.rb index f0187265e..11ad2e6f9 100644 --- a/lib/vagrant/action/box/verify.rb +++ b/lib/vagrant/action/box/verify.rb @@ -9,8 +9,8 @@ module Vagrant def call(env) begin - env.ui.info I18n.t("vagrant.actions.box.verify.verifying") - VirtualBox::Appliance.new(env["box"].ovf_file.to_s) + @env[:ui].info I18n.t("vagrant.actions.box.verify.verifying") + VirtualBox::Appliance.new(env["box_directory"].join("box.ovf").to_s) rescue Exception raise Errors::BoxVerificationFailed end diff --git a/lib/vagrant/action/vm/export.rb b/lib/vagrant/action/vm/export.rb index cdb36e6d9..2f4445e64 100644 --- a/lib/vagrant/action/vm/export.rb +++ b/lib/vagrant/action/vm/export.rb @@ -44,7 +44,7 @@ module Vagrant end def ovf_path - File.join(@env["export.temp_dir"], @env.env.config.vm.box_ovf) + File.join(@env["export.temp_dir"], "box.ovf") end end end diff --git a/lib/vagrant/box.rb b/lib/vagrant/box.rb index f6b105b14..186893584 100644 --- a/lib/vagrant/box.rb +++ b/lib/vagrant/box.rb @@ -26,17 +26,6 @@ module Vagrant @directory = directory end - # Returns path to the OVF file of the box. The OVF file is an open - # virtual machine file which contains specifications of the exported - # virtual machine this box contains. - # - # This will only be valid once the box is imported. - # - # @return [String] - def ovf_file - directory.join(env.config.vm.box_ovf) - end - # Begins the process of destroying this box. This cannot be undone! def destroy env.actions.run(:box_remove, { "box" => self, "validate" => false }) diff --git a/lib/vagrant/box_collection.rb b/lib/vagrant/box_collection.rb index b3a43f239..c8c7d4c03 100644 --- a/lib/vagrant/box_collection.rb +++ b/lib/vagrant/box_collection.rb @@ -33,7 +33,10 @@ module Vagrant # Adds a box to this collection with the given name and located # at the given URL. def add(name, url) - @action_runner.run(:box_add, :box_name => name, :box_url => url) + @action_runner.run(:box_add, + :box_name => name, + :box_url => url, + :box_directory => @directory.join(name)) end # Loads the list of all boxes from the source. This modifies the diff --git a/lib/vagrant/config/vm.rb b/lib/vagrant/config/vm.rb index d89ad1b64..6ec6c5b0b 100644 --- a/lib/vagrant/config/vm.rb +++ b/lib/vagrant/config/vm.rb @@ -12,7 +12,6 @@ module Vagrant attr_accessor :auto_port_range attr_accessor :box attr_accessor :box_url - attr_accessor :box_ovf attr_accessor :base_mac attr_accessor :boot_mode attr_accessor :host_name diff --git a/test/unit/vagrant/box_collection_test.rb b/test/unit/vagrant/box_collection_test.rb index 050ab0315..adb3fa818 100644 --- a/test/unit/vagrant/box_collection_test.rb +++ b/test/unit/vagrant/box_collection_test.rb @@ -39,7 +39,11 @@ describe Vagrant::BoxCollection do # and parameters. We leave the testing of the actual stack to # acceptance tests, and individual pieces to unit tests of each # step. - options = { :box_name => name, :box_url => url } + options = { + :box_name => name, + :box_url => url, + :box_directory => instance.directory.join(name) + } action_runner.should_receive(:run).with(:box_add, options) instance.add(name, url)