Use RemotePath proto message to upload/download files
This commit is contained in:
parent
04253a0aeb
commit
8513a14f9e
@ -451,6 +451,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||
add_message "hashicorp.vagrant.sdk.Communicator.Path" do
|
||||
optional :path, :string, 1
|
||||
end
|
||||
add_message "hashicorp.vagrant.sdk.Communicator.RemotePath" do
|
||||
optional :path, :string, 1
|
||||
end
|
||||
add_message "hashicorp.vagrant.sdk.Platform" do
|
||||
end
|
||||
add_message "hashicorp.vagrant.sdk.Platform.DetectResp" do
|
||||
@ -826,6 +829,7 @@ module Hashicorp
|
||||
Communicator::TestResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.TestResp").msgclass
|
||||
Communicator::Command = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.Command").msgclass
|
||||
Communicator::Path = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.Path").msgclass
|
||||
Communicator::RemotePath = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.RemotePath").msgclass
|
||||
Platform = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Platform").msgclass
|
||||
Platform::DetectResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Platform.DetectResp").msgclass
|
||||
Platform::ParentResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Platform.ParentResp").msgclass
|
||||
|
||||
@ -80,8 +80,8 @@ module VagrantPlugins
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: from)),
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: to)),
|
||||
type: "hashicorp.vagrant.sdk.Communicator.RemotePath",
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::RemotePath.new(path: to)),
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -103,13 +103,11 @@ 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)),
|
||||
type: "hashicorp.vagrant.sdk.Communicator.RemotePath",
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::RemotePath.new(path: to)),
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@ -34,6 +34,22 @@ module VagrantPlugins
|
||||
SDK::Communicator::Path.decode(proto.value.value)
|
||||
end
|
||||
end
|
||||
|
||||
class CommunicatorRemotePathFromSpec < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: SDK::FuncSpec::Value) { |arg|
|
||||
arg.type == "hashicorp.vagrant.sdk.Communicator.RemotePath" &&
|
||||
!arg&.value&.value.nil?
|
||||
}
|
||||
end
|
||||
super(inputs: inputs, output: SDK::Communicator::RemotePath, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto)
|
||||
SDK::Communicator::RemotePath.decode(proto.value.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -114,14 +114,11 @@ module VagrantPlugins
|
||||
name: "",
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
type: "hashicorp.vagrant.sdk.Communicator.RemotePath",
|
||||
name: "",
|
||||
)
|
||||
],
|
||||
result: [
|
||||
type: "hashicorp.vagrant.sdk.Communicator.FileTransferResp",
|
||||
name: "",
|
||||
]
|
||||
result: []
|
||||
)
|
||||
end
|
||||
|
||||
@ -148,7 +145,7 @@ module VagrantPlugins
|
||||
|
||||
communicator.download(from, to)
|
||||
|
||||
SDK::Communicator::FileTransferResp.new()
|
||||
Empty.new
|
||||
end
|
||||
end
|
||||
|
||||
@ -162,17 +159,12 @@ module VagrantPlugins
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
name: "to",
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
name: "from",
|
||||
type: "hashicorp.vagrant.sdk.Communicator.RemotePath",
|
||||
)
|
||||
],
|
||||
result: [
|
||||
type: "hashicorp.vagrant.sdk.Communicator.FileTransferResp",
|
||||
name: "",
|
||||
]
|
||||
result: []
|
||||
)
|
||||
end
|
||||
|
||||
@ -198,7 +190,7 @@ module VagrantPlugins
|
||||
|
||||
communicator.upload(from.path, to.path)
|
||||
|
||||
SDK::Communicator::FileTransferResp.new()
|
||||
Empty.new
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user