Get rid of more references to Vagrant.config. Only one remains.
This commit is contained in:
parent
b1b4ae2077
commit
af383e222a
|
@ -26,7 +26,7 @@ module Vagrant
|
||||||
|
|
||||||
def clone_and_attach
|
def clone_and_attach
|
||||||
logger.info "Cloning current VM Disk to new location (#{new_image_path})..."
|
logger.info "Cloning current VM Disk to new location (#{new_image_path})..."
|
||||||
hard_drive.image = hard_drive.image.clone(new_image_path, Vagrant.config.vm.disk_image_format, true)
|
hard_drive.image = hard_drive.image.clone(new_image_path, @runner.env.config.vm.disk_image_format, true)
|
||||||
|
|
||||||
logger.info "Attaching new disk to VM ..."
|
logger.info "Attaching new disk to VM ..."
|
||||||
@runner.vm.save
|
@runner.vm.save
|
||||||
|
@ -43,7 +43,7 @@ module Vagrant
|
||||||
|
|
||||||
# Returns the path to the new location for the hard drive
|
# Returns the path to the new location for the hard drive
|
||||||
def new_image_path
|
def new_image_path
|
||||||
File.join(Vagrant.config.vm.hd_location, hard_drive.image.filename)
|
File.join(@runner.env.config.vm.hd_location, hard_drive.image.filename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,10 +29,12 @@ module Vagrant
|
||||||
push_proc(&block)
|
push_proc(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute!
|
def execute!(config_object=nil)
|
||||||
run_procs!(config)
|
config_object ||= config
|
||||||
config.loaded!
|
|
||||||
config
|
run_procs!(config_object)
|
||||||
|
config_object.loaded!
|
||||||
|
config_object
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,17 +52,6 @@ class ConfigTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "accessing configuration" do
|
|
||||||
setup do
|
|
||||||
Vagrant::Config.run { |config| }
|
|
||||||
Vagrant::Config.execute!
|
|
||||||
end
|
|
||||||
|
|
||||||
should "forward config to the class method" do
|
|
||||||
assert_equal Vagrant.config, Vagrant::Config.config
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "initializing" do
|
context "initializing" do
|
||||||
setup do
|
setup do
|
||||||
Vagrant::Config.reset!
|
Vagrant::Config.reset!
|
||||||
|
@ -92,7 +81,14 @@ class ConfigTest < Test::Unit::TestCase
|
||||||
should "return the configuration on execute!" do
|
should "return the configuration on execute!" do
|
||||||
Vagrant::Config.run {}
|
Vagrant::Config.run {}
|
||||||
result = Vagrant::Config.execute!
|
result = Vagrant::Config.execute!
|
||||||
assert result.equal?(Vagrant.config)
|
assert result.is_a?(Vagrant::Config::Top)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "use given configuration object if given" do
|
||||||
|
fake_env = mock("env")
|
||||||
|
config = Vagrant::Config::Top.new(fake_env)
|
||||||
|
result = Vagrant::Config.execute!(config)
|
||||||
|
assert_equal config.env, result.env
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue