Hacks to let a remote machine be instantiated with or with out a client

This commit is contained in:
sophia 2022-04-14 10:44:06 -05:00
parent a40d890f74
commit e020c6600e
4 changed files with 12 additions and 3 deletions

View file

@ -105,6 +105,14 @@ module Vagrant
client.default_provider.to_sym
end
# Gets a target (machine) by name
#
# @param [String] machine name
# return [VagrantPlugins::CommandServe::Client::Machine]
def get_target(name)
client.target(name)
end
# Returns the host object associated with this environment.
#
# @return [Class]

View file

@ -60,8 +60,8 @@ module Vagrant
@name = name
@ui_mutex = Mutex.new
@state_mutex = Mutex.new
# TODO: pass in trigger config (@config.trigger)
@triggers = Vagrant::Plugin::V2::Trigger.new(@env, nil, self, @ui)
# TODO: get trigger config from go
@triggers = Vagrant::Plugin::V2::Trigger.new(@env, @config.trigger, self, @ui)
# If the ID is the special not created ID, then set our ID to
# nil so that we destroy all our data.

View file

@ -64,7 +64,7 @@ module VagrantPlugins
def converter(target)
m = target.to_machine
Vagrant::Machine.new(client=m)
Vagrant::Machine.new(nil, nil, nil, {}, {}, nil, nil, nil, nil, nil, base=false, client=m)
end
end

View file

@ -80,6 +80,7 @@ describe Vagrant::Machine::Remote do
before do
allow(env).to receive(:get_target) { client }
allow(client).to receive(:box) { box }
allow(client).to receive(:data_dir) { data_dir }
allow(client).to receive(:name) { name }