Don't use just a client to instantiate a machine
This commit is contained in:
parent
7a5d045083
commit
f1e2a73bfa
@ -97,7 +97,7 @@ module Vagrant
|
||||
# @param [Box] box The box that is backing this virtual machine.
|
||||
# @param [Environment] env The environment that this machine is a
|
||||
# part of.
|
||||
def initialize(name, provider_name, provider_cls, provider_config, provider_options, config, data_dir, box, env, vagrantfile, base=false, client=nil)
|
||||
def initialize(name, provider_name, provider_cls, provider_config, provider_options, config, data_dir, box, env, vagrantfile, base=false)
|
||||
@logger = Log4r::Logger.new("vagrant::machine")
|
||||
@logger.info("Initializing machine: #{name}")
|
||||
@logger.info(" - Provider: #{provider_cls}")
|
||||
|
||||
@ -26,47 +26,42 @@ module Vagrant
|
||||
# @param [Box] box The box that is backing this virtual machine.
|
||||
# @param [Environment] env The environment that this machine is a
|
||||
# part of.
|
||||
def initialize(name, provider_name, provider_cls, provider_config, provider_options, config, data_dir, box, env, vagrantfile, base=false, client=nil)
|
||||
def initialize(name, provider_name, provider_cls, provider_config, provider_options, config, data_dir, box, env, vagrantfile, base=false)
|
||||
@logger = Log4r::Logger.new("vagrant::machine")
|
||||
@logger.debug("building machine (remote) with client #{client}")
|
||||
if !client.nil?
|
||||
@client = client
|
||||
else
|
||||
@client = env.get_target(name)
|
||||
@env = env
|
||||
@ui = Vagrant::UI::Prefixed.new(@env.ui, name)
|
||||
@client = env.get_target(name)
|
||||
@env = env
|
||||
@ui = Vagrant::UI::Prefixed.new(@env.ui, name)
|
||||
|
||||
# TODO: Get provider info from client
|
||||
@provider_name = provider_name
|
||||
@provider = provider_cls.new(self)
|
||||
@provider._initialize(provider_name, self)
|
||||
@provider_options = provider_options
|
||||
@provider_config = provider_config
|
||||
# TODO: Get provider info from client
|
||||
@provider_name = provider_name
|
||||
@provider = provider_cls.new(self)
|
||||
@provider._initialize(provider_name, self)
|
||||
@provider_options = provider_options
|
||||
@provider_config = provider_config
|
||||
|
||||
#TODO: get box from @client.get_box()
|
||||
@box = box
|
||||
@config = config
|
||||
@data_dir = @client.data_dir
|
||||
@vagrantfile = vagrantfile
|
||||
@name = name
|
||||
@ui_mutex = Mutex.new
|
||||
@state_mutex = Mutex.new
|
||||
@triggers = Vagrant::Plugin::V2::Trigger.new(@env, @config.trigger, self, @ui)
|
||||
#TODO: get box from @client.get_box()
|
||||
@box = box
|
||||
@config = config
|
||||
@data_dir = @client.data_dir
|
||||
@vagrantfile = vagrantfile
|
||||
@name = name
|
||||
@ui_mutex = Mutex.new
|
||||
@state_mutex = Mutex.new
|
||||
@triggers = Vagrant::Plugin::V2::Trigger.new(@env, @config.trigger, self, @ui)
|
||||
|
||||
# Keep track of where our UUID should be placed
|
||||
@index_uuid_file = nil
|
||||
@index_uuid_file = @data_dir.join("index_uuid") if @data_dir
|
||||
# Keep track of where our UUID should be placed
|
||||
@index_uuid_file = nil
|
||||
@index_uuid_file = @data_dir.join("index_uuid") if @data_dir
|
||||
|
||||
# If the ID is the special not created ID, then set our ID to
|
||||
# nil so that we destroy all our data.
|
||||
# if state.id == MachineState::NOT_CREATED_ID
|
||||
# self.id = nil
|
||||
# end
|
||||
# If the ID is the special not created ID, then set our ID to
|
||||
# nil so that we destroy all our data.
|
||||
# if state.id == MachineState::NOT_CREATED_ID
|
||||
# self.id = nil
|
||||
# end
|
||||
|
||||
# Output a bunch of information about this machine in
|
||||
# machine-readable format in case someone is listening.
|
||||
@ui.machine("metadata", "provider", provider_name)
|
||||
end
|
||||
# Output a bunch of information about this machine in
|
||||
# machine-readable format in case someone is listening.
|
||||
@ui.machine("metadata", "provider", provider_name)
|
||||
end
|
||||
|
||||
# @return [Box]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user