mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[vcloud_director] Fix listing catalog items when only a single item exists.
This commit is contained in:
parent
638c93cea2
commit
873d195ddd
1 changed files with 5 additions and 1 deletions
|
@ -12,9 +12,13 @@ module Fog
|
|||
|
||||
private
|
||||
|
||||
def ensure_list(items)
|
||||
items.is_a?(Hash) ? [items] : items
|
||||
end
|
||||
|
||||
def item_list
|
||||
data = service.get_catalog(catalog.id).body
|
||||
items = data[:CatalogItems][:CatalogItem].select { |link| link[:type] == "application/vnd.vmware.vcloud.catalogItem+xml" }
|
||||
items = ensure_list(data[:CatalogItems][:CatalogItem]).select { |link| link[:type] == "application/vnd.vmware.vcloud.catalogItem+xml" }
|
||||
items.each{|item| service.add_id_from_href!(item) }
|
||||
items
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue