Use named to, from arguments for uploading files with communincator

This commit is contained in:
sophia 2021-10-29 15:36:29 -05:00 committed by Paul Hinze
parent 8a2375faf2
commit 04253a0aeb
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 8 additions and 7 deletions

View File

@ -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)),
),
]

View File

@ -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