Remove references to SDK from remote machine index

This commit is contained in:
sophia 2021-08-11 15:05:32 -04:00 committed by Paul Hinze
parent 0778e615e9
commit f722b15661
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
3 changed files with 24 additions and 22 deletions

View File

@ -25,10 +25,7 @@ module Vagrant
# @return [Boolean] true if delete is successful
def delete(uuid)
@machines.delete(uuid)
ref = Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier.new(
id: uuid
)
@client.delete(ref)
@client.delete(uuid)
end
# Accesses a machine by UUID
@ -36,10 +33,7 @@ module Vagrant
# @param [String] uuid for the machine to access.
# @return [MachineIndex::Entry]
def get(uuid)
ref = Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier.new(
id: uuid
)
@client.get(ref)
@client.get(uuid)
end
# Tests if the index has the given UUID.
@ -47,10 +41,7 @@ module Vagrant
# @param [String] uuid
# @return [Boolean]
def include?(uuid)
ref = Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier.new(
id: uuid
)
@client.include?(ref)
@client.include?(uuid)
end
def release(entry)

View File

@ -137,6 +137,8 @@ module Vagrant
# Vagrantfiles often have constants, so people would otherwise
# constantly (heh) get "already initialized constant" warnings.
begin
# TODO: Remove reference to client here. This won't work
# running legacy vagrant directly.
env = entry.vagrant_env(
@env.home_path, ui_class: @env.ui_class, client: @env.client)
rescue Vagrant::Errors::EnvironmentNonExistentCWD

View File

@ -20,26 +20,35 @@ module VagrantPlugins
@broker = broker
end
# @param [Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier]
# @param [string]
# @return [Boolean] true if delete is successful
def delete(target)
@logger.debug("deleting machine #{target} from index")
@client.delete(target)
def delete(uuid)
@logger.debug("deleting machine with id #{uuid} from index")
ref = Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier.new(
id: uuid
)
@client.delete(ref)
true
end
# @param [Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier]
# @param [string]
# @return [MachineIndex::Entry]
def get(ref)
@logger.debug("getting machine with ref #{ref} from index")
def get(uuid)
@logger.debug("getting machine with id #{uuid} from index")
ref = Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier.new(
id: uuid
)
resp = @client.get(ref)
return machine_to_entry(resp)
end
# @param [Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier]
# @param [string]
# @return [Boolean]
def include?(ref)
@logger.debug("checking for machine with ref #{ref} in index")
def include?(uuid)
@logger.debug("checking for machine with id #{uuid} in index")
ref = Hashicorp::Vagrant::Sdk::TargetIndex::TargetIdentifier.new(
id: uuid
)
@client.includes(ref).exists
end