archipel-api 3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/archipel/api/hypervisor_api.rb +69 -0
- data/lib/archipel/api/internal/api.rb +78 -0
- data/lib/archipel/api/internal/config.rb +13 -0
- data/lib/archipel/api/internal/hypervisor_xml_messages.rb +47 -0
- data/lib/archipel/api/internal/version.rb +7 -0
- data/lib/archipel/api/internal/vm_xml_messages.rb +73 -0
- data/lib/archipel/api/internal/xml/hypervisor/create_vm.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/hypervisor/delete_vm.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/hypervisor/list_users.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/hypervisor/list_vm.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/hypervisor/register_user.xml.erb +5 -0
- data/lib/archipel/api/internal/xml/hypervisor/unregister_user.xml.erb +5 -0
- data/lib/archipel/api/internal/xml/todo/clone_vm.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/vm/create_disk.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/vm/define_vm.xml.erb +72 -0
- data/lib/archipel/api/internal/xml/vm/grant_permissions.xml.erb +12 -0
- data/lib/archipel/api/internal/xml/vm/list_disks.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/vm/remove_disk.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/vm/start.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/vm/subscribe.xml.erb +3 -0
- data/lib/archipel/api/internal/xml/vm/xml.xml.erb +3 -0
- data/lib/archipel/api/internal/xml_messages.rb +23 -0
- data/lib/archipel/api/vm_api.rb +36 -0
- data/lib/archipel/api.rb +14 -0
- metadata +166 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 027c7f37fbabd9081fbd5232d9ad976e036b923b
|
4
|
+
data.tar.gz: 1ed8f3692c9ed43f49214dcfc29708244b2dc1d7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e20c1dc3a83ef3c8c4edba618d4f2b80c7c7d750512d12ed04972903ab4a90afa3e0d9a52d5ecf308db4f0844c485403b4796fa976a90d3f8317e0d9ee2bacc6
|
7
|
+
data.tar.gz: a2c40450ff293b858dba791d5aa4bc2f6a962e14d1525aae321be6ace6f87de6738dbf5faf941cc1a665d1e82b665bb9f146d9cd7228310fd499ade36f6f6df2
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative 'internal/api'
|
2
|
+
require_relative 'internal/hypervisor_xml_messages'
|
3
|
+
|
4
|
+
class Archipel::Api::HypervisorApi < Archipel::Api::Internal::Api
|
5
|
+
def initialize login: nil, password: nil, server: nil, hypervisor: nil
|
6
|
+
@api = Archipel::Api::Internal::HypervisorXmlMessages.new
|
7
|
+
super({login: login,
|
8
|
+
password: password,
|
9
|
+
server: server,
|
10
|
+
hypervisor: hypervisor})
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_vm name, user_jid
|
14
|
+
resp = method_missing :create_vm, name, user_jid
|
15
|
+
vm_jid = resp['query'][0]['virtualmachine'][0]['jid']
|
16
|
+
hypervisor_name = resp['from'].split('@')[0]
|
17
|
+
vm_jid + '/' + hypervisor_name
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete_vm jid_or_name
|
21
|
+
if jid_or_name.include? '@'
|
22
|
+
jid = jid_or_name
|
23
|
+
else
|
24
|
+
name = jid_or_name
|
25
|
+
jid = get_vm_jid_by_name name
|
26
|
+
end
|
27
|
+
method_missing :delete_vm, jid
|
28
|
+
end
|
29
|
+
|
30
|
+
def list_vm
|
31
|
+
resp = method_missing :list_vm
|
32
|
+
vms_resp = resp['query'][0]['item']
|
33
|
+
vms = {}
|
34
|
+
vms_resp.each do |vm|
|
35
|
+
vms[vm['name']] = vm['content']
|
36
|
+
end
|
37
|
+
vms
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_vm_jid_by_name name
|
41
|
+
jid = list_vm[name]
|
42
|
+
raise "VM #{name} not found" if jid.nil?
|
43
|
+
jid
|
44
|
+
end
|
45
|
+
|
46
|
+
def list_users human_only = true
|
47
|
+
all_users = []
|
48
|
+
page = 0
|
49
|
+
loop do
|
50
|
+
resp = method_missing :list_users, page, human_only
|
51
|
+
users = resp['query'][0]['user']
|
52
|
+
break if users.blank?
|
53
|
+
|
54
|
+
all_users += users
|
55
|
+
page += 1
|
56
|
+
end
|
57
|
+
|
58
|
+
all_users.map { |e| e['jid'].downcase }
|
59
|
+
end
|
60
|
+
|
61
|
+
def user_exist? jid
|
62
|
+
list_users.include? jid.downcase
|
63
|
+
end
|
64
|
+
|
65
|
+
def method_missing symbol, *args
|
66
|
+
xml = @api.send symbol, *args
|
67
|
+
call xml
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'xmlsimple'
|
3
|
+
require 'xmpp4r'
|
4
|
+
require 'thread'
|
5
|
+
require 'active_support/core_ext/numeric/time'
|
6
|
+
|
7
|
+
|
8
|
+
class Archipel::Api::Internal::Api
|
9
|
+
def initialize config
|
10
|
+
config = config.merge Archipel::Api.get_defaults
|
11
|
+
|
12
|
+
@config = config
|
13
|
+
config_missing = %i(login password server hypervisor).any? do |property|
|
14
|
+
config[property].nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
if config_missing
|
18
|
+
raise "Login, password, server or hypervisor not provided. " +
|
19
|
+
"Use Archipel.defaults or provide constructor parameters to #{self.class.name}."
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def call xml, to = @config[:hypervisor]
|
24
|
+
debug xml
|
25
|
+
|
26
|
+
output = in_connection do |client|
|
27
|
+
iq = Jabber::Iq.new :set, to
|
28
|
+
iq.add REXML::Document.new(xml).elements[1]
|
29
|
+
client.send iq
|
30
|
+
wait_for_reply 60.seconds, client
|
31
|
+
end
|
32
|
+
|
33
|
+
ret = XmlSimple.xml_in output
|
34
|
+
raise Exception, ret['error'][0]['text'][0] if ret['error']
|
35
|
+
ret
|
36
|
+
end
|
37
|
+
|
38
|
+
def in_connection
|
39
|
+
Jabber.debug = @config[:xmpp_debug]
|
40
|
+
client = Jabber::Client.new Jabber::JID.new @config[:login]
|
41
|
+
client.connect @config[:server]
|
42
|
+
client.auth @config[:password]
|
43
|
+
ret = yield client
|
44
|
+
client.close
|
45
|
+
ret
|
46
|
+
end
|
47
|
+
|
48
|
+
def wait_for_reply timeout, client
|
49
|
+
output = nil
|
50
|
+
|
51
|
+
mutex = Mutex.new
|
52
|
+
condition = ConditionVariable.new
|
53
|
+
|
54
|
+
client.add_stanza_callback do |stanza|
|
55
|
+
next unless %w(result error).include? stanza.attributes['type']
|
56
|
+
output = stanza.to_s
|
57
|
+
debug output
|
58
|
+
mutex.synchronize { condition.signal }
|
59
|
+
end
|
60
|
+
|
61
|
+
mutex.synchronize { condition.wait mutex, timeout }
|
62
|
+
raise StandardError, "No response given in #{timeout} seconds" unless output
|
63
|
+
output
|
64
|
+
end
|
65
|
+
|
66
|
+
protected
|
67
|
+
def debug text
|
68
|
+
return unless debug?
|
69
|
+
$stderr.puts
|
70
|
+
$stderr.puts text
|
71
|
+
$stderr.puts
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
def debug?
|
76
|
+
@config[:debug]
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Archipel::Api::Internal::Config
|
2
|
+
attr_reader :config
|
3
|
+
|
4
|
+
|
5
|
+
def initialize name
|
6
|
+
config_file = File.join Rails.root, 'config', "#{name}.yml"
|
7
|
+
@config = YAML.load_file(config_file)[Rails.env].deep_symbolize_keys
|
8
|
+
end
|
9
|
+
|
10
|
+
def [] entry
|
11
|
+
@config[entry]
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative 'xml_messages'
|
2
|
+
|
3
|
+
|
4
|
+
class Archipel::Api::Internal::HypervisorXmlMessages
|
5
|
+
include Archipel::Api::Internal::XmlMessages
|
6
|
+
|
7
|
+
def register_user jid, password
|
8
|
+
render 'register_user', jid: jid, password: password
|
9
|
+
end
|
10
|
+
|
11
|
+
def unregister_user jid
|
12
|
+
render 'unregister_user', jid: jid
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_vm name, user_jid
|
16
|
+
parameters = {
|
17
|
+
name: name, userid: user_jid,
|
18
|
+
orgname: 'StratusHost', orgunit: 'CumulusHost/pacmanvps', locality: 'Gdansk, Poland', categories: 'Archipel'
|
19
|
+
}
|
20
|
+
render 'create_vm', parameters: parameters
|
21
|
+
end
|
22
|
+
|
23
|
+
def list_vm
|
24
|
+
render 'list_vm'
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete_vm jid
|
28
|
+
render 'delete_vm', jid: jid
|
29
|
+
end
|
30
|
+
|
31
|
+
def grant_permissions jid, user_jid
|
32
|
+
enabled = %w(settags getavatars setavatar presence message info create shutdown destroy reboot suspend resume xmldesc networkinfo define undefine capabilities nodeinfo network_getnames network_bridges appliance_get appliance_attach appliance_detach appliance_package drives_get oom_getadjust scheduler_jobs scheduler_schedule scheduler_unschedule scheduler_actions vnc_display snapshot_take snapshot_delete snapshot_get snapshot_current snapshot_revert)
|
33
|
+
disabled = %w(all permission_get permission_getown permission_list permission_set permission_setown subscription_add subscription_remove migrate autostart memory setvcpus free xmppserver_users_list xmppserver_users_number oom_setadjust drives_create drives_delete drives_getiso drives_convert drives_rename vmparking_park)
|
34
|
+
|
35
|
+
render 'grant_permissions', jid: jid, user_jid: user_jid,
|
36
|
+
enabled_permissions: enabled, disabled_permissions: disabled
|
37
|
+
end
|
38
|
+
|
39
|
+
def list_users page = 0, humans_only = true
|
40
|
+
render 'list_users', page: page, humans_only: humans_only
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def generate_mac
|
45
|
+
(1..6).map { '%0.2X' % rand(256) }.join ':'
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative 'xml_messages'
|
2
|
+
|
3
|
+
|
4
|
+
class Archipel::Api::Internal::VmXmlMessages
|
5
|
+
include Archipel::Api::Internal::XmlMessages
|
6
|
+
|
7
|
+
def create_disk jid, name, size_gb, format = 'qcow2'
|
8
|
+
render 'create_disk', jid: jid, uuid: uuid_from_jid(jid),
|
9
|
+
name: name, size: size_gb, format: format
|
10
|
+
end
|
11
|
+
|
12
|
+
def define_vm jid, params = {}
|
13
|
+
params = params.dup
|
14
|
+
|
15
|
+
uuid = uuid_from_jid jid
|
16
|
+
params.merge! jid: jid, uuid: uuid
|
17
|
+
|
18
|
+
params.merge! mac: generate_mac unless params.key? :mac
|
19
|
+
|
20
|
+
if params.key? :ip
|
21
|
+
params[:ips] = [params[:ip]]
|
22
|
+
end
|
23
|
+
|
24
|
+
params[:vnc_password] = generate_password 50 unless params.key? :vnc_password
|
25
|
+
params[:vnc_port] = -1 unless params.key? :vnc_port
|
26
|
+
|
27
|
+
render 'define_vm', params
|
28
|
+
end
|
29
|
+
|
30
|
+
def list_disks jid
|
31
|
+
render 'list_disks', uuid: uuid_from_jid(jid)
|
32
|
+
end
|
33
|
+
|
34
|
+
def remove_disk jid, file
|
35
|
+
render 'remove_disk', uuid: uuid_from_jid(jid), file: file
|
36
|
+
end
|
37
|
+
|
38
|
+
def grant_permissions jid, user_jid
|
39
|
+
enabled = %w(settags getavatars setavatar presence message info create shutdown destroy reboot suspend resume xmldesc networkinfo define undefine capabilities nodeinfo network_getnames network_bridges appliance_get appliance_attach appliance_detach appliance_package drives_get oom_getadjust scheduler_jobs scheduler_schedule scheduler_unschedule scheduler_actions vnc_display snapshot_take snapshot_delete snapshot_get snapshot_current snapshot_revert)
|
40
|
+
disabled = %w(all permission_get permission_getown permission_list permission_set permission_setown subscription_add subscription_remove migrate autostart memory setvcpus free xmppserver_users_list xmppserver_users_number oom_setadjust drives_create drives_delete drives_getiso drives_convert drives_rename vmparking_park)
|
41
|
+
|
42
|
+
render 'grant_permissions', jid: jid, uuid: uuid_from_jid(jid), user_jid: user_jid,
|
43
|
+
enabled_permissions: enabled, disabled_permissions: disabled
|
44
|
+
end
|
45
|
+
|
46
|
+
def revoke_permissions jid, user_jid
|
47
|
+
disabled = %w(settags getavatars setavatar presence message info create shutdown destroy reboot suspend resume xmldesc networkinfo define undefine capabilities nodeinfo network_getnames network_bridges appliance_get appliance_attach appliance_detach appliance_package drives_get oom_getadjust scheduler_jobs scheduler_schedule scheduler_unschedule scheduler_actions vnc_display snapshot_take snapshot_delete snapshot_get snapshot_current snapshot_revert all permission_get permission_getown permission_list permission_set permission_setown subscription_add subscription_remove migrate autostart memory setvcpus free xmppserver_users_list xmppserver_users_number oom_setadjust drives_create drives_delete drives_getiso drives_convert drives_rename vmparking_park)
|
48
|
+
|
49
|
+
render 'grant_permissions', jid: jid, uuid: uuid_from_jid(jid), user_jid: user_jid,
|
50
|
+
enabled_permissions: [], disabled_permissions: disabled
|
51
|
+
end
|
52
|
+
|
53
|
+
def start jid
|
54
|
+
render 'start', jid: jid, uuid: uuid_from_jid(jid)
|
55
|
+
end
|
56
|
+
|
57
|
+
def xml jid
|
58
|
+
render 'xml', jid: jid, uuid: uuid_from_jid(jid)
|
59
|
+
end
|
60
|
+
|
61
|
+
def subscribe jid, user_jid
|
62
|
+
render 'subscribe', jid: jid, uuid: uuid_from_jid(jid), user_jid: user_jid
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
def generate_mac
|
67
|
+
(1..6).map { '%0.2X' % rand(256) }.join ':'
|
68
|
+
end
|
69
|
+
|
70
|
+
def uuid_from_jid jid
|
71
|
+
jid.split('@').first
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<query xmlns="archipel:vm:definition">
|
2
|
+
<archipel action="define">
|
3
|
+
<domain type="kvm">
|
4
|
+
<name><%= name %></name>
|
5
|
+
<uuid><%= uuid %></uuid>
|
6
|
+
<memory unit="MiB"><%= memory %></memory>
|
7
|
+
<currentMemory unit="MiB"><%= memory %></currentMemory>
|
8
|
+
<vcpu><%= cpu %></vcpu>
|
9
|
+
<os>
|
10
|
+
<type machine="pc-1.3" arch="x86_64">hvm</type>
|
11
|
+
<boot dev="hd"/>
|
12
|
+
<bootmenu enable="yes"/>
|
13
|
+
</os>
|
14
|
+
<clock offset="utc"/>
|
15
|
+
<on_poweroff>destroy</on_poweroff>
|
16
|
+
<on_reboot>restart</on_reboot>
|
17
|
+
<on_crash>restart</on_crash>
|
18
|
+
<features>
|
19
|
+
<acpi/>
|
20
|
+
<apic/>
|
21
|
+
</features>
|
22
|
+
<devices>
|
23
|
+
<emulator>/usr/bin/qemu-kvm</emulator>
|
24
|
+
<disk device="disk" type="file">
|
25
|
+
<driver cache="none" type="qcow2" name="qemu"/>
|
26
|
+
<%= tag :source, file: "/var/lib/libvirt/images/archipel/drives/#{uuid}/disk.qcow2" %>
|
27
|
+
<target bus="virtio" dev="vda"/>
|
28
|
+
<address slot="0x04" bus="0x00" domain="0x0000" type="pci" function="0x0"/>
|
29
|
+
</disk>
|
30
|
+
<disk device="cdrom" type="file">
|
31
|
+
<driver cache="none" type="raw" name="qemu"/>
|
32
|
+
<%= tag :source, file: "/var/lib/libvirt/images/archipel/iso/#{iso}.iso" %>
|
33
|
+
<target bus="ide" dev="hdc"/>
|
34
|
+
<readonly/>
|
35
|
+
<address bus="1" controller="0" type="drive" target="0" unit="0"/>
|
36
|
+
</disk>
|
37
|
+
<interface type="bridge">
|
38
|
+
<% tag :mac, address: mac %>
|
39
|
+
<source bridge="br0"/>
|
40
|
+
<target dev="vnet0"/>
|
41
|
+
<model type="rtl8139"/>
|
42
|
+
<filterref filter="clean-traffic">
|
43
|
+
<% ips.each do |ip| %>
|
44
|
+
<%= tag :parameter, name: 'IP', value: ip %>
|
45
|
+
<% end %>
|
46
|
+
</filterref>
|
47
|
+
<alias name="net0"/>
|
48
|
+
<address slot="0x03" bus="0x00" domain="0x0000" type="pci" function="0x0"/>
|
49
|
+
</interface>
|
50
|
+
<%= content_tag :graphics, passwd: vnc_password, port: vnc_port, listen: '127.0.0.1', autoport: 'yes',
|
51
|
+
multiuser: 'yes', fullscreen: 'no', keymap: 'en-us', type: 'vnc' do %>
|
52
|
+
<listen type="address" address="127.0.0.1"/>
|
53
|
+
<% end %>
|
54
|
+
<input type="mouse" bus="ps2"/>
|
55
|
+
<serial type="pty">
|
56
|
+
<target port="0"/>
|
57
|
+
</serial>
|
58
|
+
<controller type="usb" index="0">
|
59
|
+
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x2"/>
|
60
|
+
</controller>
|
61
|
+
<controller type="ide" index="0">
|
62
|
+
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x1"/>
|
63
|
+
</controller>
|
64
|
+
<controller type="pci" index="0" model="pci-root"/>
|
65
|
+
<video>
|
66
|
+
<model type="vga" vram="9216" heads="1"/>
|
67
|
+
<address bus="0x00" domain="0x0000" function="0x0" slot="0x02" type="pci"/>
|
68
|
+
</video>
|
69
|
+
</devices>
|
70
|
+
</domain>
|
71
|
+
</archipel>
|
72
|
+
</query>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<query xmlns="archipel:permissions">
|
2
|
+
<archipel action="set">
|
3
|
+
<% enabled_permissions.each do |permission| %>
|
4
|
+
<%= tag :permission, permission_target: "#{user_jid}", permission_name: permission,
|
5
|
+
permission_value: 1, permission_type: 'user' %>
|
6
|
+
<% end %>
|
7
|
+
<% disabled_permissions.each do |permission| %>
|
8
|
+
<%= tag :permission, permission_target: "#{user_jid}", permission_name: permission,
|
9
|
+
permission_value: 0, permission_type: 'user' %>
|
10
|
+
<% end %>
|
11
|
+
</archipel>
|
12
|
+
</query>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'action_view'
|
2
|
+
|
3
|
+
module Archipel::Api::Internal::XmlMessages
|
4
|
+
protected
|
5
|
+
def render template, **values
|
6
|
+
current_dir = File.dirname __FILE__
|
7
|
+
templates_dir = "#{current_dir}/xml/#{subdir}"
|
8
|
+
template_file = "#{template}.xml.erb"
|
9
|
+
ActionView::Base.new(templates_dir).render \
|
10
|
+
file: template_file,
|
11
|
+
locals: values
|
12
|
+
end
|
13
|
+
|
14
|
+
def subdir
|
15
|
+
self.class.name.match('Archipel::Api::Internal::(.*)XmlMessages')[1].downcase
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_password length
|
19
|
+
# http://stackoverflow.com/a/88341/504845
|
20
|
+
chars = [('a'..'z'), ('A'..'Z'), ('0' .. '9')].map { |i| i.to_a }.flatten
|
21
|
+
(0...length).map { chars[rand(chars.length)] }.join
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative 'internal/api'
|
2
|
+
require_relative 'internal/vm_xml_messages'
|
3
|
+
|
4
|
+
|
5
|
+
class Archipel::Api::VmApi < Archipel::Api::Internal::Api
|
6
|
+
def initialize login: nil, password: nil, server: nil, hypervisor: nil
|
7
|
+
@api = Archipel::Api::Internal::VmXmlMessages.new
|
8
|
+
super({login: login,
|
9
|
+
password: password,
|
10
|
+
server: server})
|
11
|
+
end
|
12
|
+
|
13
|
+
def remove_disk jid, name, format
|
14
|
+
disks = list_disks jid
|
15
|
+
found_disk = disks.find do |disk|
|
16
|
+
disk['name'] == name && disk['format'] == format
|
17
|
+
end
|
18
|
+
method_missing :remove_disk, jid, found_disk['path']
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_disks jid
|
22
|
+
out = method_missing :list_disks, jid
|
23
|
+
out['query'][0]['disk'] || []
|
24
|
+
end
|
25
|
+
|
26
|
+
def xml jid
|
27
|
+
out = method_missing :xml, jid
|
28
|
+
out['query'][0]['domain'][0]
|
29
|
+
end
|
30
|
+
|
31
|
+
def method_missing symbol, *args
|
32
|
+
to = args[0]
|
33
|
+
xml = @api.send symbol, *args
|
34
|
+
call xml, to
|
35
|
+
end
|
36
|
+
end
|
data/lib/archipel/api.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Archipel
|
2
|
+
module Api
|
3
|
+
module Internal
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.defaults login: nil, password: nil, server: nil, hypervisor: nil, ** kwargs
|
7
|
+
@config = {login: login, password: password, server: server, hypervisor: hypervisor}
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.get_defaults
|
11
|
+
@config || {}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: archipel-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '3'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Damian Nowak
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionpack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: xml-simple
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: xmpp4r
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.14'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.14'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-core
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.14'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.14'
|
111
|
+
description: Ruby API for Archipel Agent, an XMPP-based orchestrator. See http://archipelproject.org/.
|
112
|
+
email:
|
113
|
+
- damian.nowak@pacmanvps.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- lib/archipel/api.rb
|
119
|
+
- lib/archipel/api/hypervisor_api.rb
|
120
|
+
- lib/archipel/api/internal/api.rb
|
121
|
+
- lib/archipel/api/internal/config.rb
|
122
|
+
- lib/archipel/api/internal/hypervisor_xml_messages.rb
|
123
|
+
- lib/archipel/api/internal/version.rb
|
124
|
+
- lib/archipel/api/internal/vm_xml_messages.rb
|
125
|
+
- lib/archipel/api/internal/xml/hypervisor/create_vm.xml.erb
|
126
|
+
- lib/archipel/api/internal/xml/hypervisor/delete_vm.xml.erb
|
127
|
+
- lib/archipel/api/internal/xml/hypervisor/list_users.xml.erb
|
128
|
+
- lib/archipel/api/internal/xml/hypervisor/list_vm.xml.erb
|
129
|
+
- lib/archipel/api/internal/xml/hypervisor/register_user.xml.erb
|
130
|
+
- lib/archipel/api/internal/xml/hypervisor/unregister_user.xml.erb
|
131
|
+
- lib/archipel/api/internal/xml/todo/clone_vm.xml.erb
|
132
|
+
- lib/archipel/api/internal/xml/vm/create_disk.xml.erb
|
133
|
+
- lib/archipel/api/internal/xml/vm/define_vm.xml.erb
|
134
|
+
- lib/archipel/api/internal/xml/vm/grant_permissions.xml.erb
|
135
|
+
- lib/archipel/api/internal/xml/vm/list_disks.xml.erb
|
136
|
+
- lib/archipel/api/internal/xml/vm/remove_disk.xml.erb
|
137
|
+
- lib/archipel/api/internal/xml/vm/start.xml.erb
|
138
|
+
- lib/archipel/api/internal/xml/vm/subscribe.xml.erb
|
139
|
+
- lib/archipel/api/internal/xml/vm/xml.xml.erb
|
140
|
+
- lib/archipel/api/internal/xml_messages.rb
|
141
|
+
- lib/archipel/api/vm_api.rb
|
142
|
+
homepage: https://bitbucket.org/stratushost/ruby-archipel-api
|
143
|
+
licenses:
|
144
|
+
- MIT
|
145
|
+
metadata: {}
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 2.1.0
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 2.2.2
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: API for Archipel Agent, an XMPP-based orchestrator
|
166
|
+
test_files: []
|