kytoon 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +29 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +81 -0
- data/Rakefile +35 -0
- data/VERSION +1 -0
- data/config/server_group_vpc.json +14 -0
- data/config/server_group_xen.json +24 -0
- data/lib/kytoon.rb +8 -0
- data/lib/kytoon/providers/cloud_servers_vpc.rb +6 -0
- data/lib/kytoon/providers/cloud_servers_vpc/client.rb +197 -0
- data/lib/kytoon/providers/cloud_servers_vpc/connection.rb +148 -0
- data/lib/kytoon/providers/cloud_servers_vpc/server.rb +121 -0
- data/lib/kytoon/providers/cloud_servers_vpc/server_group.rb +401 -0
- data/lib/kytoon/providers/cloud_servers_vpc/ssh_public_key.rb +29 -0
- data/lib/kytoon/providers/cloud_servers_vpc/vpn_network_interface.rb +33 -0
- data/lib/kytoon/providers/xenserver.rb +1 -0
- data/lib/kytoon/providers/xenserver/server_group.rb +371 -0
- data/lib/kytoon/server_group.rb +46 -0
- data/lib/kytoon/ssh_util.rb +23 -0
- data/lib/kytoon/util.rb +118 -0
- data/lib/kytoon/version.rb +8 -0
- data/lib/kytoon/vpn/vpn_connection.rb +46 -0
- data/lib/kytoon/vpn/vpn_network_manager.rb +237 -0
- data/lib/kytoon/vpn/vpn_openvpn.rb +112 -0
- data/lib/kytoon/xml_util.rb +15 -0
- data/rake/kytoon.rake +115 -0
- data/test/client_test.rb +111 -0
- data/test/helper.rb +18 -0
- data/test/server_group_test.rb +253 -0
- data/test/server_test.rb +69 -0
- data/test/ssh_util_test.rb +22 -0
- data/test/test_helper.rb +194 -0
- data/test/test_kytoon.rb +7 -0
- data/test/util_test.rb +23 -0
- data/test/vpn_network_manager_test.rb +40 -0
- metadata +247 -0
data/test/server_test.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
module Kytoon
|
5
|
+
module Providers
|
6
|
+
module CloudServersVPC
|
7
|
+
|
8
|
+
class ServerTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
include Kytoon::Providers::CloudServersVPC
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@tmp_dir=TmpDir.new_tmp_dir
|
14
|
+
ServerGroup.data_dir=@tmp_dir
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
FileUtils.rm_rf(@tmp_dir)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_vpn_server_rebuild_fails
|
22
|
+
group=ServerGroup.from_xml(SERVER_GROUP_XML)
|
23
|
+
server=group.server("login1")
|
24
|
+
assert_raises(RuntimeError) do
|
25
|
+
server.rebuild
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_rebuild
|
30
|
+
group=ServerGroup.from_xml(SERVER_GROUP_XML)
|
31
|
+
server=group.server("test1")
|
32
|
+
Connection.stubs(:post).returns("")
|
33
|
+
server.rebuild
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_from_to_xml
|
37
|
+
server=Server.from_xml(SERVER_XML)
|
38
|
+
server=Server.from_xml(server.to_xml)
|
39
|
+
assert_equal "db1", server.name
|
40
|
+
assert_equal "blah", server.description
|
41
|
+
assert_equal 1234, server.id
|
42
|
+
assert_equal "888", server.cloud_server_id_number
|
43
|
+
assert_equal 999, server.server_group_id
|
44
|
+
assert_equal "10.119.225.116", server.internal_ip_addr
|
45
|
+
assert_equal "123.100.100.100", server.external_ip_addr
|
46
|
+
assert_equal "Online", server.status
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_create
|
50
|
+
|
51
|
+
Connection.stubs(:post).returns(SERVER_XML)
|
52
|
+
server=Server.create(Server.from_xml(SERVER_XML))
|
53
|
+
assert_equal "db1", server.name
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_delete
|
58
|
+
|
59
|
+
server=Server.from_xml(SERVER_XML)
|
60
|
+
Connection.stubs(:delete).returns("")
|
61
|
+
assert server.delete
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
module Kytoon
|
7
|
+
|
8
|
+
class SshUtilTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def test_remove_known_hosts_ip
|
11
|
+
|
12
|
+
t=Tempfile.new('ssh_test')
|
13
|
+
t.write(%{login,172.19.0.1 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAu1Xfhjj0hZwDIXWa6Gd/Qk/S9VwO5ec9+u6CMLMteQY4seeXmpu643k8zCa6yLuDXyzucknfrsxtOKJVQ6F5glXW6+Ko/zPiPNQbeC6GIKDs2a3m6A5OJSqRHqoy0RTJu11Acs3tkWUgmvBKFX7jxEZuHJM1kI0/xP0JlO0zOVr8+9Wg6Zy5KfVnEsgbdaEvpk3Rrtt5Lm42w/uxvPTFY7AWBhUfloYqBQrX6zd8d17jHLCnukHmvdR7eVGihXREtvDjX4ycG1o5/9amLWR0ELVFkFiXPHyWCuyl21j5uI7Ro9P2pga5ypnDB+N1BjFJHSMMofT40XOBkzAxBUrLgw==\n})
|
14
|
+
t.flush
|
15
|
+
SshUtil.remove_known_hosts_ip('login,172.19.0.1', t.path)
|
16
|
+
assert_equal "", IO.read(t.path)
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'mocha'
|
4
|
+
KYTOON_PROJECT = "#{File.dirname(__FILE__)}" unless defined?(KYTOON_PROJECT)
|
5
|
+
|
6
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
7
|
+
require 'kytoon'
|
8
|
+
|
9
|
+
require 'tempfile'
|
10
|
+
require 'fileutils'
|
11
|
+
|
12
|
+
class TmpDir
|
13
|
+
|
14
|
+
def self.new_tmp_dir(prefix="kytoon")
|
15
|
+
|
16
|
+
tmp_file=Tempfile.new prefix
|
17
|
+
path=tmp_file.path
|
18
|
+
tmp_file.close(true)
|
19
|
+
FileUtils.mkdir_p path
|
20
|
+
return path
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
SERVER_GROUP_XML = %{
|
27
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
28
|
+
<server-group>
|
29
|
+
<created-at type="datetime">2010-10-15T15:15:58-04:00</created-at>
|
30
|
+
<description>test description</description>
|
31
|
+
<domain-name>mydomain.net</domain-name>
|
32
|
+
<historical type="boolean">false</historical>
|
33
|
+
<id type="integer">1759</id>
|
34
|
+
<last-used-ip-address>172.19.0.2</last-used-ip-address>
|
35
|
+
<name>test</name>
|
36
|
+
<owner-name>dan.prince</owner-name>
|
37
|
+
<updated-at type="datetime">2010-10-15T15:15:58-04:00</updated-at>
|
38
|
+
<user-id type="integer">3</user-id>
|
39
|
+
<vpn-network>172.19.0.0</vpn-network>
|
40
|
+
<vpn-subnet>255.255.128.0</vpn-subnet>
|
41
|
+
<servers type="array">
|
42
|
+
<server>
|
43
|
+
<account-id type="integer">3</account-id>
|
44
|
+
<cloud-server-id-number type="integer">1</cloud-server-id-number>
|
45
|
+
<created-at type="datetime">2010-10-15T15:15:58-04:00</created-at>
|
46
|
+
<description>login1</description>
|
47
|
+
<error-message nil="true"></error-message>
|
48
|
+
<external-ip-addr>184.106.205.120</external-ip-addr>
|
49
|
+
<flavor-id type="integer">4</flavor-id>
|
50
|
+
<historical type="boolean">false</historical>
|
51
|
+
<id type="integer">5513</id>
|
52
|
+
<image-id type="integer">14</image-id>
|
53
|
+
<internal-ip-addr>10.179.107.203</internal-ip-addr>
|
54
|
+
<name>login1</name>
|
55
|
+
<openvpn-server type="boolean">true</openvpn-server>
|
56
|
+
<retry-count type="integer">0</retry-count>
|
57
|
+
<server-group-id type="integer">1759</server-group-id>
|
58
|
+
<status>Online</status>
|
59
|
+
<updated-at type="datetime">2010-10-15T15:18:22-04:00</updated-at>
|
60
|
+
<vpn-network-interfaces type="array"/>
|
61
|
+
</server>
|
62
|
+
<server>
|
63
|
+
<account-id type="integer">3</account-id>
|
64
|
+
<cloud-server-id-number type="integer">2</cloud-server-id-number>
|
65
|
+
<created-at type="datetime">2010-10-15T15:15:58-04:00</created-at>
|
66
|
+
<description>test1</description>
|
67
|
+
<error-message nil="true"></error-message>
|
68
|
+
<external-ip-addr>184.106.205.121</external-ip-addr>
|
69
|
+
<flavor-id type="integer">49</flavor-id>
|
70
|
+
<historical type="boolean">false</historical>
|
71
|
+
<id type="integer">5513</id>
|
72
|
+
<image-id type="integer">49</image-id>
|
73
|
+
<internal-ip-addr>10.179.107.204</internal-ip-addr>
|
74
|
+
<name>test1</name>
|
75
|
+
<openvpn-server type="boolean">false</openvpn-server>
|
76
|
+
<retry-count type="integer">0</retry-count>
|
77
|
+
<server-group-id type="integer">1759</server-group-id>
|
78
|
+
<status>Online</status>
|
79
|
+
<updated-at type="datetime">2010-10-15T15:18:22-04:00</updated-at>
|
80
|
+
<vpn-network-interfaces type="array"/>
|
81
|
+
</server>
|
82
|
+
</servers>
|
83
|
+
</server-group>
|
84
|
+
}
|
85
|
+
|
86
|
+
CLIENT_XML = %{
|
87
|
+
<client>
|
88
|
+
<created-at type="datetime">2011-01-09T19:37:32-05:00</created-at>
|
89
|
+
<description>Toolkit Client: local</description>
|
90
|
+
<id type="integer">5</id>
|
91
|
+
<is-windows type="boolean">false</is-windows>
|
92
|
+
<name>local</name>
|
93
|
+
<server-group-id type="integer">11</server-group-id>
|
94
|
+
<status>Online</status>
|
95
|
+
<updated-at type="datetime">2011-01-09T19:37:37-05:00</updated-at>
|
96
|
+
<vpn-network-interfaces type="array">
|
97
|
+
<vpn-network-interface>
|
98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
+
-----END CERTIFICATE-----
|
146
|
+
</client-cert>
|
147
|
+
<client-key>-----BEGIN RSA PRIVATE KEY-----
|
148
|
+
MIICXQIBAAKBgQCefsUr0T4oQUjKjW7Dpx0tKwwafBF2HUW7CI75apeTjSBgYC1C
|
149
|
+
HC6cggfFkUTFvndzspbGaeuJeYtvcvkAa2BDp4jlSJgEXa+Uy1UAj1y06BePLNbK
|
150
|
+
F4EfgEGf3eIWcdOtLYbOg4k33uNgto168iVOowWOR+B2/z73NIHWxvtF3wIDAQAB
|
151
|
+
AoGAf3tFykWl8ij4jHsP8Wz0CcWLGa5bOR64XIS4wyKaQoML3JjfLkKOtzHbYGzE
|
152
|
+
3Syi1bt6jKLbYZsSrRTT9SNorB3M2HI/uu1NHVyJ8fqxSJs9wQWv26XcMq6iPXR6
|
153
|
+
JQmiG44r0NoHtDOw0NCoo+9il4wjTIVSwN58x69EO1hsWokCQQDREYW73F536KzN
|
154
|
+
GSsLy+8VsaRiHCboi7lZwITGt4xFhykP/P5R/mNMTklVpJENuZH5jhiBr8r2O/XE
|
155
|
+
NQpIEZiFAkEAwhL4EnXax5p50g2CpkJM2B9F/p3IjjMs/sdUh4/RvAVkVAzz7uOh
|
156
|
+
TjtrL0T6480wA7rk3324IG5x4XTgXYVkEwJBAKkg7LgJ0N5d+xS8TIdxhctd9uZr
|
157
|
+
ccpj5iDGTmNXbwF8EurdNnvsODYtisPeqn2Y5o8ktYyMQrupy+rbIaMloOUCQAsI
|
158
|
+
pQ33oV6jy7VDi2AEePX4oTQeqF5dTnuVvZqPdK8p51BYBC5axrr56dggJdt5uPcd
|
159
|
+
UxHZxfQiE1tsF615ff0CQQCjeBskODATJkbN0kw+6FIF9m7QoEAYtJD1jLiY/2Sv
|
160
|
+
QRiYX+gvycrIph1yyIGA1qeHYnjhQp4ZijhcwSFUAAyF
|
161
|
+
-----END RSA PRIVATE KEY-----
|
162
|
+
</client-key>
|
163
|
+
<created-at type="datetime">2011-01-09T19:37:32-05:00</created-at>
|
164
|
+
<id type="integer">15</id>
|
165
|
+
<interfacable-id type="integer">5</interfacable-id>
|
166
|
+
<interfacable-type>Client</interfacable-type>
|
167
|
+
<ptp-ip-addr>172.19.0.6</ptp-ip-addr>
|
168
|
+
<updated-at type="datetime">2011-01-09T19:37:36-05:00</updated-at>
|
169
|
+
<vpn-ip-addr>172.19.0.5</vpn-ip-addr>
|
170
|
+
</vpn-network-interface>
|
171
|
+
</vpn-network-interfaces>
|
172
|
+
</client>
|
173
|
+
}
|
174
|
+
|
175
|
+
SERVER_XML = %{
|
176
|
+
|
177
|
+
<linux-server>
|
178
|
+
<cloud-server-id-number type="integer">888</cloud-server-id-number>
|
179
|
+
<created-at type="datetime">2010-07-29T10:27:33-04:00</created-at>
|
180
|
+
<description>blah</description>
|
181
|
+
<error-message nil="true"></error-message>
|
182
|
+
<external-ip-addr>123.100.100.100</external-ip-addr>
|
183
|
+
<flavor-id type="integer">3</flavor-id>
|
184
|
+
<id type="integer">1234</id>
|
185
|
+
<image-id type="integer">14</image-id>
|
186
|
+
<internal-ip-addr>10.119.225.116</internal-ip-addr>
|
187
|
+
<name>db1</name>
|
188
|
+
<openvpn-server type="boolean">false</openvpn-server>
|
189
|
+
<retry-count type="integer">0</retry-count>
|
190
|
+
<server-group-id type="integer">999</server-group-id>
|
191
|
+
<status>Online</status>
|
192
|
+
<updated-at type="datetime">2010-07-29T11:19:04-04:00</updated-at>
|
193
|
+
</linux-server>
|
194
|
+
}
|
data/test/test_kytoon.rb
ADDED
data/test/util_test.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
module Kytoon
|
5
|
+
|
6
|
+
class UtilTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def test_hostname
|
9
|
+
|
10
|
+
assert_not_nil Util.hostname
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_load_public_key
|
15
|
+
|
16
|
+
key=Util.load_public_key
|
17
|
+
assert_not_nil key
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
module Kytoon
|
7
|
+
module Vpn
|
8
|
+
|
9
|
+
class VpnNetworkManagerTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
include Kytoon::Providers::CloudServersVPC
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@group=ServerGroup.from_xml(SERVER_GROUP_XML)
|
15
|
+
@client=Client.from_xml(CLIENT_XML)
|
16
|
+
tmpdir=TmpDir.new_tmp_dir
|
17
|
+
File.open(File.join(tmpdir, "gconftool-2"), 'w') do |f|
|
18
|
+
f.write("#!/bin/bash\nexit 0")
|
19
|
+
f.chmod(0755)
|
20
|
+
end
|
21
|
+
ENV['PATH']=tmpdir+":"+ENV['PATH']
|
22
|
+
@vpn_net_man = VpnNetworkManager.new(@group, @client)
|
23
|
+
end
|
24
|
+
|
25
|
+
def teardown
|
26
|
+
@vpn_net_man.delete_certs
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_configure_gconf
|
30
|
+
assert @vpn_net_man.configure_gconf
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_ip_to_integer
|
34
|
+
assert_equal 16782252, @vpn_net_man.ip_to_integer("172.19.0.1")
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,247 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kytoon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dan Prince
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rdoc
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.12'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.12'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.1.4
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.4
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: builder
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.0.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: jeweler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.3
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.3
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: uuidtools
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.1.2
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.1.2
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: mocha
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.12.1
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.12.1
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: builder
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: json
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: uuidtools
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
description: A set of Rake tasks that provide a framework to help automate the creation
|
175
|
+
and configuration of VPC server groups.
|
176
|
+
email: dprince@redhat.com
|
177
|
+
executables: []
|
178
|
+
extensions: []
|
179
|
+
extra_rdoc_files:
|
180
|
+
- LICENSE.txt
|
181
|
+
- README.rdoc
|
182
|
+
files:
|
183
|
+
- .document
|
184
|
+
- Gemfile
|
185
|
+
- Gemfile.lock
|
186
|
+
- LICENSE.txt
|
187
|
+
- README.rdoc
|
188
|
+
- Rakefile
|
189
|
+
- VERSION
|
190
|
+
- config/server_group_vpc.json
|
191
|
+
- config/server_group_xen.json
|
192
|
+
- lib/kytoon.rb
|
193
|
+
- lib/kytoon/providers/cloud_servers_vpc.rb
|
194
|
+
- lib/kytoon/providers/cloud_servers_vpc/client.rb
|
195
|
+
- lib/kytoon/providers/cloud_servers_vpc/connection.rb
|
196
|
+
- lib/kytoon/providers/cloud_servers_vpc/server.rb
|
197
|
+
- lib/kytoon/providers/cloud_servers_vpc/server_group.rb
|
198
|
+
- lib/kytoon/providers/cloud_servers_vpc/ssh_public_key.rb
|
199
|
+
- lib/kytoon/providers/cloud_servers_vpc/vpn_network_interface.rb
|
200
|
+
- lib/kytoon/providers/xenserver.rb
|
201
|
+
- lib/kytoon/providers/xenserver/server_group.rb
|
202
|
+
- lib/kytoon/server_group.rb
|
203
|
+
- lib/kytoon/ssh_util.rb
|
204
|
+
- lib/kytoon/util.rb
|
205
|
+
- lib/kytoon/version.rb
|
206
|
+
- lib/kytoon/vpn/vpn_connection.rb
|
207
|
+
- lib/kytoon/vpn/vpn_network_manager.rb
|
208
|
+
- lib/kytoon/vpn/vpn_openvpn.rb
|
209
|
+
- lib/kytoon/xml_util.rb
|
210
|
+
- rake/kytoon.rake
|
211
|
+
- test/client_test.rb
|
212
|
+
- test/helper.rb
|
213
|
+
- test/server_group_test.rb
|
214
|
+
- test/server_test.rb
|
215
|
+
- test/ssh_util_test.rb
|
216
|
+
- test/test_helper.rb
|
217
|
+
- test/test_kytoon.rb
|
218
|
+
- test/util_test.rb
|
219
|
+
- test/vpn_network_manager_test.rb
|
220
|
+
homepage: http://github.com/dprince/kytoon
|
221
|
+
licenses: []
|
222
|
+
post_install_message:
|
223
|
+
rdoc_options: []
|
224
|
+
require_paths:
|
225
|
+
- lib
|
226
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
227
|
+
none: false
|
228
|
+
requirements:
|
229
|
+
- - ! '>='
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '0'
|
232
|
+
segments:
|
233
|
+
- 0
|
234
|
+
hash: 1256682396353941801
|
235
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
|
+
none: false
|
237
|
+
requirements:
|
238
|
+
- - ! '>='
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '0'
|
241
|
+
requirements: []
|
242
|
+
rubyforge_project:
|
243
|
+
rubygems_version: 1.8.24
|
244
|
+
signing_key:
|
245
|
+
specification_version: 3
|
246
|
+
summary: Create & configure ephemeral virtual private clouds.
|
247
|
+
test_files: []
|