Clean up from rebase
This commit is contained in:
parent
514b4e3d89
commit
b9e7d2197e
@ -17,23 +17,6 @@ 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.Args.NamedPaths" &&
|
||||
!arg&.value&.value.nil?
|
||||
}
|
||||
end
|
||||
super(inputs: inputs, output: SDK::Args::NamedPaths, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto)
|
||||
SDK::Args::NamedPaths.decode(proto.value.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -109,37 +109,6 @@ module VagrantPlugins
|
||||
proto.list.map do |v|
|
||||
mapper.map(v)
|
||||
end
|
||||
class StructFromSpec < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: SDK::FuncSpec::Value) { |arg|
|
||||
arg.type == "google.protobuf.Struct" &&
|
||||
!arg&.value&.value.nil?
|
||||
}
|
||||
end
|
||||
super(inputs: inputs, output: Hash, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto)
|
||||
h = proto.value.unpack(Google::Protobuf::Struct).to_h
|
||||
h.transform_keys(&:to_sym)
|
||||
end
|
||||
end
|
||||
|
||||
class KnownStringType < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: SDK::FuncSpec::Value) { |arg|
|
||||
arg.value.type_url == "type.googleapis.com/google.protobuf.Value" &&
|
||||
!arg&.value&.value.nil? && arg.type == "" && converter(arg).is_a?(String)
|
||||
}
|
||||
end
|
||||
super(inputs: inputs, output: String, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto)
|
||||
val = proto.value.unpack(Google::Protobuf::Value)
|
||||
val.to_ruby
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user