mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Get box metadata client from box
This commit is contained in:
parent
428c3b02fd
commit
1f5d66fd76
2 changed files with 15 additions and 1 deletions
|
|
@ -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…
Reference in a new issue