[vcloud|compute] method to find catalog item by name across all catalogs
This commit is contained in:
parent
9aeeb5abe1
commit
c865ec6d16
|
@ -22,6 +22,17 @@ module Fog
|
||||||
@organization_uri ||= connection.default_organization_uri
|
@organization_uri ||= connection.default_organization_uri
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def item_by_name(name)
|
||||||
|
res = nil
|
||||||
|
items = all.collect { |catalog| catalog.catalog_items }
|
||||||
|
items.each do |i|
|
||||||
|
i.collect do |ii|
|
||||||
|
res = ii if ii.name == name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
res
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Vcloud
|
||||||
def self.template
|
def self.template
|
||||||
template_name = ENV['VCLOUD_TEMPLATE']
|
template_name = ENV['VCLOUD_TEMPLATE']
|
||||||
raise "Specify VApp template name in VCLOUD_TEMPLATE env var" unless template_name
|
raise "Specify VApp template name in VCLOUD_TEMPLATE env var" unless template_name
|
||||||
template_res = Vcloud.catalogs.first.catalog_items.select {|ci| ci.name == template_name }[0]
|
template_res = Vcloud.catalogs.item_by_name template_name
|
||||||
raise "URI Not found for specified template - check template name" unless template_res
|
raise "URI Not found for specified template - check template name" unless template_res
|
||||||
template_res.href
|
template_res.href
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue