Sha256: 0389fdea507cdd7ded7bffd6ecbc955453f11856ee67551f80185a9ecebfa825
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
class ServerGroup @@group_class = nil # called to init the configured group class we will use def self.init return if not @@group_class.nil? configs = Util.load_configs group_type = ENV['GROUP_TYPE'] || configs['group_type'] if group_type == "cloud_server_vpc" then require 'kytoon/providers/cloud_servers_vpc' @@group_class = Kytoon::Providers::CloudServersVPC::ServerGroup elsif group_type == "xenserver" then require 'kytoon/providers/xenserver' @@group_class = Kytoon::Providers::Xenserver::ServerGroup elsif group_type == "libvirt" then require 'kytoon/providers/libvirt' @@group_class = Kytoon::Providers::Libvirt::ServerGroup else raise "Invalid 'group_type' specified in config file." end end def self.index(options) self.init @@group_class.index(options) end def self.create self.init json_config_file=ENV['SERVER_GROUP_JSON'] if json_config_file.nil? then json_config_file = @@group_class::CONFIG_FILE end sg = @@group_class.from_json(IO.read(json_config_file)) @@group_class.create(sg) end def self.get self.init id = ENV['GROUP_ID'] @@group_class.get(:id => id) end def self.delete self.init id = ENV['GROUP_ID'] sg = @@group_class.get(:id => id) sg.delete end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kytoon-1.1.1 | lib/kytoon/server_group.rb |