1
0
Fork 0
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:
rsalm 2013-09-18 20:59:35 +03:00
parent 638c93cea2
commit 873d195ddd

View file

@ -12,9 +12,13 @@ module Fog
private private
def ensure_list(items)
items.is_a?(Hash) ? [items] : items
end
def item_list def item_list
data = service.get_catalog(catalog.id).body 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.each{|item| service.add_id_from_href!(item) }
items items
end end