1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/glesys/models/compute/templates.rb

28 lines
715 B
Ruby

require 'fog/core/collection'
require 'fog/glesys/models/compute/template'
module Fog
module Compute
class Glesys
class Templates < Fog::Collection
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
load(templates)
end
end
end
end
end