Box add works again with new env stuff
This commit is contained in:
parent
75d5dfdae0
commit
d92f3d8c6d
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 })
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue