Update clients to subclass Client

This commit is contained in:
Chris Roberts 2022-01-21 14:11:32 -08:00 committed by Paul Hinze
parent c413335e14
commit 6e16a8835c
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
10 changed files with 23 additions and 64 deletions

View File

@ -1,11 +1,7 @@
module VagrantPlugins
module CommandServe
module Client
class Basis
prepend Util::ClientSetup
prepend Util::HasLogger
prepend Util::HasMapper
class Client
class Basis < Client
# return [Sdk::Args::DataDir::Basis]
def data_dirs
resp = client.data_dir(Empty.new)

View File

@ -1,10 +1,7 @@
module VagrantPlugins
module CommandServe
module Client
class Box
prepend Util::ClientSetup
prepend Util::HasLogger
class Client
class Box < Client
# @return [Bool] check allowed
def automatic_update_check_allowed
res = client.automatic_update_check_allowed(Empty.new)
@ -33,7 +30,8 @@ module VagrantPlugins
# @param [String] path
def repackage(path)
client.repackage(SDK::Args::Path.new(path: path.to_s))
path = Pathname.new(path.to_s)
client.repackage(mapper.map(path, to: SDK::Args::Path))
end
# @return [String] path
@ -79,7 +77,7 @@ module VagrantPlugins
res = client.compare(box)
res.result
end
end
end
end
end
end

View File

@ -1,10 +1,7 @@
module VagrantPlugins
module CommandServe
module Client
class BoxCollection
prepend Util::ClientSetup
prepend Util::HasLogger
class Client
class BoxCollection < Client
# @return [Vagrant::Box] box added
def add(path, name, version, force=false, metadata_url=nil, providers=[])
logger.debug("adding box at path #{path}")

View File

@ -1,12 +1,7 @@
module VagrantPlugins
module CommandServe
module Client
class PluginManager
prepend Util::ClientSetup
prepend Util::HasLogger
prepend Util::HasMapper
class Client
class PluginManager < Client
def list_plugins(types=[])
resp = client.list_plugins(
SDK::PluginManager::PluginsRequest.new(

View File

@ -1,10 +1,7 @@
module VagrantPlugins
module CommandServe
module Client
class Project
prepend Util::ClientSetup
prepend Util::HasLogger
class Client
class Project < Client
# return [VagrantPlugins::CommandServe::Client::BoxCollection]
def boxes
BoxCollection.load(

View File

@ -1,12 +1,7 @@
require "google/protobuf/well_known_types"
module VagrantPlugins
module CommandServe
module Client
class StateBag
prepend Util::ClientSetup
prepend Util::HasLogger
class Client
class StateBag < Client
# @param [String]
# @return [String]
def get(key)

View File

@ -2,14 +2,10 @@ require "time"
module VagrantPlugins
module CommandServe
module Client
class Target
class Client
class Target < Client
autoload :Machine, Vagrant.source_root.join("plugins/commands/serve/client/target/machine").to_s
prepend Util::ClientSetup
prepend Util::HasLogger
STATES = [
:UNKNOWN,
:PENDING,

View File

@ -1,15 +1,11 @@
module VagrantPlugins
module CommandServe
module Client
class Client
# Machine is a specialization of a generic Target
# and is how legacy Vagrant willl interact with
# targets
class Target
class Machine < Target
prepend Util::ClientSetup
prepend Util::HasLogger
# @return [String] resource identifier for this target
def ref
SDK::Ref::Target::Machine.new(resource_id: resource_id)
@ -97,7 +93,7 @@ module VagrantPlugins
client.set_state(req)
end
# Synced folder for machine
# Synced folder for machine
#
# @return [List<[Client::SyncedFolder, Map<String, String>]>]
def synced_folders

View File

@ -1,11 +1,7 @@
module VagrantPlugins
module CommandServe
module Client
class TargetIndex
prepend Util::ClientSetup
prepend Util::HasLogger
class Client
class TargetIndex < Client
# @param [string]
# @return [Boolean] true if delete is successful
def delete(ident)

View File

@ -1,14 +1,7 @@
# TODO(spox): why do we need this?!
require_relative "../util.rb"
module VagrantPlugins
module CommandServe
module Client
class Terminal
prepend Util::ClientSetup
prepend Util::HasLogger
class Client
class Terminal < Client
# @return [String] name of proto class
def self.sdk_alias
"TerminalUI"