From 04253a0aeb6a9c8d0f408a9636bb9919c4b660b4 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 29 Oct 2021 15:36:29 -0500 Subject: [PATCH] Use named to, from arguments for uploading files with communincator --- plugins/commands/serve/client/communicator.rb | 2 ++ .../commands/serve/service/communicator_service.rb | 13 ++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/commands/serve/client/communicator.rb b/plugins/commands/serve/client/communicator.rb index 44d44048a..eef94c421 100644 --- a/plugins/commands/serve/client/communicator.rb +++ b/plugins/commands/serve/client/communicator.rb @@ -103,10 +103,12 @@ module VagrantPlugins ), SDK::FuncSpec::Value.new( type: "hashicorp.vagrant.sdk.Communicator.Path", + name: "to", value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: from)), ), SDK::FuncSpec::Value.new( type: "hashicorp.vagrant.sdk.Communicator.Path", + name: "from", value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: to)), ), ] diff --git a/plugins/commands/serve/service/communicator_service.rb b/plugins/commands/serve/service/communicator_service.rb index ff54c36bf..f0d29212b 100644 --- a/plugins/commands/serve/service/communicator_service.rb +++ b/plugins/commands/serve/service/communicator_service.rb @@ -162,11 +162,11 @@ module VagrantPlugins ), SDK::FuncSpec::Value.new( type: "hashicorp.vagrant.sdk.Communicator.Path", - name: "", + name: "to", ), SDK::FuncSpec::Value.new( type: "hashicorp.vagrant.sdk.Communicator.Path", - name: "", + name: "from", ) ], result: [ @@ -187,17 +187,16 @@ module VagrantPlugins logger.debug("Got from #{from}") logger.debug("Got to #{to}") - logger.info("mapping received arguments to guest machine") - machine = mapper.map(target, to: Vagrant::Machine) - logger.debug("Got machine #{machine}") + project = target.project + env = Vagrant::Environment.new({client: project}) + machine = env.machine(target.name.to_sym, target.provider_name.to_sym) plugin = Vagrant.plugin("2").manager.communicators[plugin_name.to_s.to_sym] logger.debug("Got plugin #{plugin}") - communicator = plugin.new(machine) logger.debug("communicator: #{communicator}") - communicator.upload(from, to) + communicator.upload(from.path, to.path) SDK::Communicator::FileTransferResp.new() end