2011-08-10 09:03:51 -04:00
|
|
|
require 'fog/core/collection'
|
2011-09-08 17:07:04 -04:00
|
|
|
require 'fog/glesys/models/compute/template'
|
2011-08-10 09:03:51 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Glesys
|
|
|
|
|
|
|
|
class Templates < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Glesys::Compute::Template
|
|
|
|
|
|
|
|
def all
|
2013-01-26 09:17:04 -05:00
|
|
|
request = service.template_list.body
|
|
|
|
templates = request['response']['templates']
|
2011-08-10 09:03:51 -04:00
|
|
|
|
2013-01-26 09:17:04 -05:00
|
|
|
# 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)
|
2011-08-10 09:03:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|