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
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Vagrant
|
||||||
attr_reader :system
|
attr_reader :system
|
||||||
attr_accessor :vm
|
attr_accessor :vm
|
||||||
|
|
||||||
class << self
|
class <<self
|
||||||
# Finds a virtual machine by a given UUID and either returns
|
# Finds a virtual machine by a given UUID and either returns
|
||||||
# a Vagrant::VM object or returns nil.
|
# a Vagrant::VM object or returns nil.
|
||||||
def find(uuid, env=nil)
|
def find(uuid, env=nil)
|
||||||
|
@ -36,7 +36,7 @@ module Vagrant
|
||||||
error_and_exit(:system_invalid_class, :system => system.to_s) unless @system.is_a?(Systems::Base)
|
error_and_exit(:system_invalid_class, :system => system.to_s) unless @system.is_a?(Systems::Base)
|
||||||
elsif system.is_a?(Symbol)
|
elsif system.is_a?(Symbol)
|
||||||
# Hard-coded internal systems
|
# Hard-coded internal systems
|
||||||
mapping = { :linux => Systems::Linux }
|
mapping = { :linux => Systems::Linux }
|
||||||
|
|
||||||
if !mapping.has_key?(system)
|
if !mapping.has_key?(system)
|
||||||
error_and_exit(:system_unknown_type, :system => system.to_s)
|
error_and_exit(:system_unknown_type, :system => system.to_s)
|
||||||
|
|
|
@ -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