diff --git a/lib/vagrant/environment/remote.rb b/lib/vagrant/environment/remote.rb index afcd427f5..964af6086 100644 --- a/lib/vagrant/environment/remote.rb +++ b/lib/vagrant/environment/remote.rb @@ -99,6 +99,10 @@ module Vagrant end @vagrantfile end + + def to_proto + client.proto + end end end end diff --git a/lib/vagrant/guest/remote.rb b/lib/vagrant/guest/remote.rb index e67e2db62..a817b6fd8 100644 --- a/lib/vagrant/guest/remote.rb +++ b/lib/vagrant/guest/remote.rb @@ -63,6 +63,10 @@ module Vagrant def name client.parents[0] end + + def to_proto + client.proto + end end end end diff --git a/lib/vagrant/machine_index/remote.rb b/lib/vagrant/machine_index/remote.rb index 4c9994c66..aeba3d28f 100644 --- a/lib/vagrant/machine_index/remote.rb +++ b/lib/vagrant/machine_index/remote.rb @@ -141,6 +141,10 @@ module Vagrant @logger.debug("machines: #{@machines.keys}") @machines.each_value(&block) end + + def to_proto + client.proto + end end end end diff --git a/plugins/commands/serve/client/guest.rb b/plugins/commands/serve/client/guest.rb index 3effcce5a..33db0f20a 100644 --- a/plugins/commands/serve/client/guest.rb +++ b/plugins/commands/serve/client/guest.rb @@ -7,18 +7,21 @@ module VagrantPlugins extend Util::Connector + attr_reader :broker attr_reader :client + attr_reader :proto - def initialize(conn, broker=nil) + def initialize(conn, proto, broker=nil) @logger = Log4r::Logger.new("vagrant::command::serve::client::guest") @logger.debug("connecting to guest service on #{conn}") @client = SDK::GuestService::Stub.new(conn, :this_channel_is_insecure) @broker = broker + @proto = proto end def self.load(raw_guest, broker:) g = raw_guest.is_a?(String) ? SDK::Args::Guest.decode(raw_guest) : raw_guest - self.new(connect(proto: g, broker: broker), broker) + self.new(connect(proto: g, broker: broker), g, broker) end # @return [] parents diff --git a/plugins/commands/serve/client/machine.rb b/plugins/commands/serve/client/machine.rb index 8a04cbdaf..a8d702d0d 100644 --- a/plugins/commands/serve/client/machine.rb +++ b/plugins/commands/serve/client/machine.rb @@ -8,14 +8,16 @@ module VagrantPlugins extend Util::Connector + attr_reader :broker + attr_reader :client attr_reader :proto def initialize(conn, proto, broker=nil) @logger = Log4r::Logger.new("vagrant::command::serve::client::machine") @logger.debug("connecting to target machine service on #{conn}") @client = SDK::TargetMachineService::Stub.new(conn, :this_channel_is_insecure) - @proto = proto @broker = broker + @proto = proto end def self.load(raw_machine, broker:) diff --git a/plugins/commands/serve/client/project.rb b/plugins/commands/serve/client/project.rb index bcb0b36d1..9a62adf3e 100644 --- a/plugins/commands/serve/client/project.rb +++ b/plugins/commands/serve/client/project.rb @@ -6,17 +6,19 @@ module VagrantPlugins attr_reader :broker attr_reader :client + attr_reader :proto - def initialize(conn, broker=nil) + def initialize(conn, proto, broker=nil) @logger = Log4r::Logger.new("vagrant::command::serve::client::project") @logger.debug("connecting to project service on #{conn}") @client = SDK::ProjectService::Stub.new(conn, :this_channel_is_insecure) @broker = broker + @proto = proto end def self.load(raw_project, broker:) p = raw_project.is_a?(String) ? SDK::Args::Project.decode(raw_project) : raw_project - self.new(connect(proto: p, broker: broker), broker) + self.new(connect(proto: p, broker: broker), p, broker) end # return [String] diff --git a/plugins/commands/serve/client/target.rb b/plugins/commands/serve/client/target.rb index d36e64b13..ead069337 100644 --- a/plugins/commands/serve/client/target.rb +++ b/plugins/commands/serve/client/target.rb @@ -16,17 +16,19 @@ module VagrantPlugins attr_reader :broker attr_reader :client + attr_reader :proto - def initialize(conn, broker=nil) + def initialize(conn, proto, broker=nil) @logger = Log4r::Logger.new("vagrant::command::serve::client::target") @logger.debug("connecting to target on #{conn}") @client = SDK::TargetService::Stub.new(conn, :this_channel_is_insecure) @broker = broker + @proto = proto end def self.load(raw_target, broker:) t = raw_target.is_a?(String) ? SDK::Args::Target.decode(raw_target) : raw_target - self.new(connect(proto: t, broker: broker), broker) + self.new(connect(proto: t, broker: broker), t, broker) end # @return [SDK::Ref::Target] proto reference for this target diff --git a/plugins/commands/serve/client/target_index.rb b/plugins/commands/serve/client/target_index.rb index 3633335fb..44ee141a3 100644 --- a/plugins/commands/serve/client/target_index.rb +++ b/plugins/commands/serve/client/target_index.rb @@ -5,19 +5,21 @@ module VagrantPlugins extend Util::Connector - attr_reader :client attr_reader :broker + attr_reader :client + attr_reader :proto - def initialize(conn, broker=nil) + def initialize(conn, proto, broker=nil) @logger = Log4r::Logger.new("vagrant::command::serve::client::targetindex") @logger.debug("connecting to target index service on #{conn}") @client = SDK::TargetIndexService::Stub.new(conn, :this_channel_is_insecure) @broker = broker + @proto = proto end def self.load(raw_index, broker:) m = raw_index.is_a?(String) ? SDK::Args::TargetIndex.decode(raw_index) : raw_index - self.new(connect(proto: m, broker: broker), broker) + self.new(connect(proto: m, broker: broker), m, broker) end # @param [string] diff --git a/plugins/commands/serve/client/terminal.rb b/plugins/commands/serve/client/terminal.rb index 7f4d6b6c5..08f56215b 100644 --- a/plugins/commands/serve/client/terminal.rb +++ b/plugins/commands/serve/client/terminal.rb @@ -7,16 +7,20 @@ module VagrantPlugins class Terminal extend Util::Connector + attr_reader :broker attr_reader :client + attr_reader :proto # @params [String] endpoint for the core service - def initialize(server_endpoint) + def initialize(server_endpoint, proto, broker=nil) @client = SDK::TerminalUIService::Stub.new(server_endpoint, :this_channel_is_insecure) + @broker = broker + @proto = proto end def self.load(raw_terminal, broker:) t = raw_terminal.is_a?(String) ? SDK::Args::TerminalUI.decode(raw_terminal) : raw_terminal - self.new(connect(proto: t, broker: broker)) + self.new(connect(proto: t, broker: broker), t, broker) end # @param [Array] lines Lines to print