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:
parent
3a4cefed77
commit
0b9a7c6428
1 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue