Get box metadata client from box
This commit is contained in:
parent
428c3b02fd
commit
1f5d66fd76
@ -61,7 +61,7 @@ module VagrantPlugins
|
||||
# @return [Hash] metadata (from metadata_url)
|
||||
def metadata
|
||||
res = client.metadata(Empty.new)
|
||||
mapper.map(res.metadata, to: Hash)
|
||||
mapper.map(res.metadata, to: Client::BoxMetadata)
|
||||
end
|
||||
|
||||
# @return [String] metadata url
|
||||
|
||||
@ -34,6 +34,20 @@ module VagrantPlugins
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class BoxMetadataFromProto < Mapper
|
||||
def initialize
|
||||
inputs = [].tap do |i|
|
||||
i << Input.new(type: SDK::Args::BoxMetadata)
|
||||
i << Input.new(type: Broker)
|
||||
end
|
||||
super(inputs: inputs, output: Client::BoxMetadata, func: method(:converter))
|
||||
end
|
||||
|
||||
def converter(proto, broker)
|
||||
Client::BoxMetadata.load(proto, broker: broker)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user