1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[Glesys] Only make one request when fetching templates

This commit is contained in:
Simon Gate 2013-01-26 15:17:04 +01:00
parent 3a4cefed77
commit 0b9a7c6428

View file

@ -10,10 +10,16 @@ module Fog
model Fog::Glesys::Compute::Template
def all
openvz = service.template_list.body['response']['templates']['OpenVZ']
xen = service.template_list.body['response']['templates']['Xen']
request = service.template_list.body
templates = request['response']['templates']
load(xen+openvz)
# Only select OpenVZ and Xen platforms
# Glesys only offers Xen and OpenVZ but they have other platforms in the list
templates = templates.select do |platform, templates|
%w|openvz xen|.include?(platform.downcase)
end.collect{|platform, templates| templates}.flatten
load(templates)
end
end