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

[glesys] Platform methods to templates

This commit is contained in:
Simon Gate 2013-02-10 13:33:04 +01:00
parent 564176e284
commit 4bd242db0c

View file

@ -10,16 +10,29 @@ module Fog
model Fog::Glesys::Compute::Template
def all
request = service.template_list.body
templates = request['response']['templates']
# 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
images = platform :openvz, :xen
load(images)
end
load(templates)
def openvz
images = platform :openvz
load(images)
end
def xen
images = platform :xen
load(images)
end
private
def platform(*platforms)
images = service.template_list.body['response']['templates']
images.select do |platform, images|
platforms.include?(platform.downcase.to_sym)
end.collect{|platform, images| images}.flatten
end
end