Add mapper for communincator path proto
This commit is contained in:
parent
1f2084cd17
commit
8a2375faf2
@ -76,12 +76,12 @@ module VagrantPlugins
|
||||
value: Google::Protobuf::Any.pack(machine.to_proto)
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Args::Path.new(path: from)),
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: from)),
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Args::Path.new(path: to)),
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: to)),
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -102,12 +102,12 @@ module VagrantPlugins
|
||||
value: Google::Protobuf::Any.pack(machine.to_proto)
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Args::Path.new(path: from)),
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: from)),
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Args::Path.new(path: to)),
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
value: Google::Protobuf::Any.pack(SDK::Communicator::Path.new(path: to)),
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@ -17,6 +17,23 @@ module VagrantPlugins
|
||||
SDK::Communicator::Command.decode(proto.value.value)
|
||||
end
|
||||
end
|
||||
|
||||
# Build a communicator path from a FuncSpec value
|
||||
class CommunicatorPathFromSpec < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: SDK::FuncSpec::Value) { |arg|
|
||||
arg.type == "hashicorp.vagrant.sdk.Communicator.Path" &&
|
||||
!arg&.value&.value.nil?
|
||||
}
|
||||
end
|
||||
super(inputs: inputs, output: SDK::Communicator::Path, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto)
|
||||
SDK::Communicator::Path.decode(proto.value.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -110,11 +110,11 @@ module VagrantPlugins
|
||||
name: "",
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
name: "",
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
name: "",
|
||||
)
|
||||
],
|
||||
@ -161,11 +161,11 @@ module VagrantPlugins
|
||||
name: "",
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
name: "",
|
||||
),
|
||||
SDK::FuncSpec::Value.new(
|
||||
type: "hashicorp.vagrant.sdk.Args.Path",
|
||||
type: "hashicorp.vagrant.sdk.Communicator.Path",
|
||||
name: "",
|
||||
)
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user