kytoon 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/lib/kytoon/providers/cloud_cue/server_group.rb +15 -4
- data/test/server_group_test.rb +9 -13
- data/test/test_helper.rb +3 -96
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
* Tue Aug 20 2013 Dan Prince <dprince@redhat.com> - 1.4.1
|
2
|
+
-Add ability to list remote groups with CloudCue provider.
|
3
|
+
-Test fixes for CloudCue.
|
4
|
+
|
1
5
|
* Wed Jul 19 2013 Dan Prince <dprince@redhat.com> - 1.4.0
|
2
6
|
-Add support for CloudCue.
|
3
7
|
-Drop old CloudServers VPC stuff (no longer in use)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.1
|
@@ -292,7 +292,8 @@ class ServerGroup
|
|
292
292
|
# :source - valid options are 'cache' and 'remote'
|
293
293
|
def self.get(options={})
|
294
294
|
|
295
|
-
source =
|
295
|
+
source = ENV['KYTOON_CLOUDCUE_SOURCE'] or options[:source]
|
296
|
+
source = 'cache' if source.nil? or source.empty?
|
296
297
|
id = options[:id]
|
297
298
|
if id.nil? then
|
298
299
|
group = ServerGroup.most_recent
|
@@ -316,10 +317,20 @@ class ServerGroup
|
|
316
317
|
# :source - valid options are 'remote' and 'cache'
|
317
318
|
def self.index(options={})
|
318
319
|
|
319
|
-
source =
|
320
|
+
source = ENV['KYTOON_CLOUDCUE_SOURCE'] or options[:source]
|
321
|
+
source = 'cache' if source.nil? or source.empty?
|
320
322
|
server_groups=[]
|
321
|
-
|
322
|
-
|
323
|
+
|
324
|
+
if source == "remote" then
|
325
|
+
xml=Connection.get("/server_groups.xml")
|
326
|
+
dom = REXML::Document.new(xml)
|
327
|
+
REXML::XPath.each(dom, "//server-group") do |group_xml|
|
328
|
+
server_groups << ServerGroup.from_xml(group_xml.to_s)
|
329
|
+
end
|
330
|
+
else
|
331
|
+
Dir[File.join(ServerGroup.data_dir, '*.xml')].each do |file|
|
332
|
+
server_groups << ServerGroup.from_xml(IO.read(file))
|
333
|
+
end
|
323
334
|
end
|
324
335
|
server_groups
|
325
336
|
|
data/test/server_group_test.rb
CHANGED
@@ -3,6 +3,7 @@ require 'test_helper'
|
|
3
3
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'tempfile'
|
6
|
+
require 'kytoon/providers/cloud_cue'
|
6
7
|
|
7
8
|
module Kytoon
|
8
9
|
module Providers
|
@@ -12,7 +13,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
12
13
|
|
13
14
|
def setup
|
14
15
|
@tmp_dir=TmpDir.new_tmp_dir
|
15
|
-
ServerGroup.data_dir=@tmp_dir
|
16
|
+
CloudCue::ServerGroup.data_dir=@tmp_dir
|
16
17
|
end
|
17
18
|
|
18
19
|
def teardown
|
@@ -129,7 +130,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
129
130
|
File.open("#{tmp_dir}/1759.xml", 'w') do |f|
|
130
131
|
f.write(SERVER_GROUP_XML)
|
131
132
|
end
|
132
|
-
ServerGroup.data_dir=tmp_dir
|
133
|
+
CloudCue::ServerGroup.data_dir=tmp_dir
|
133
134
|
|
134
135
|
Connection.stubs(:get).returns(SERVER_GROUP_XML)
|
135
136
|
|
@@ -146,11 +147,6 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
146
147
|
ServerGroup.get(:id => "1234", :source => "cache")
|
147
148
|
end
|
148
149
|
|
149
|
-
#invalid get source
|
150
|
-
assert_raises(RuntimeError) do
|
151
|
-
ServerGroup.get(:id => "1759", :source => "asdf")
|
152
|
-
end
|
153
|
-
|
154
150
|
end
|
155
151
|
|
156
152
|
def test_index_from_cache
|
@@ -159,7 +155,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
159
155
|
File.open("#{tmp_dir}/1759.xml", 'w') do |f|
|
160
156
|
f.write(SERVER_GROUP_XML)
|
161
157
|
end
|
162
|
-
ServerGroup.data_dir=tmp_dir
|
158
|
+
CloudCue::ServerGroup.data_dir=tmp_dir
|
163
159
|
|
164
160
|
server_groups = ServerGroup.index
|
165
161
|
|
@@ -174,7 +170,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
174
170
|
File.open("#{tmp_dir}/1759.xml", 'w') do |f|
|
175
171
|
f.write(SERVER_GROUP_XML)
|
176
172
|
end
|
177
|
-
ServerGroup.data_dir=tmp_dir
|
173
|
+
CloudCue::ServerGroup.data_dir=tmp_dir
|
178
174
|
|
179
175
|
Connection.stubs(:get).returns(SERVER_GROUP_XML)
|
180
176
|
server_groups = ServerGroup.index(:source => "remote")
|
@@ -192,7 +188,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
192
188
|
File.open("#{tmp_dir}/1759.xml", 'w') do |f|
|
193
189
|
f.write(SERVER_GROUP_XML)
|
194
190
|
end
|
195
|
-
ServerGroup.data_dir=tmp_dir
|
191
|
+
CloudCue::ServerGroup.data_dir=tmp_dir
|
196
192
|
|
197
193
|
Connection.stubs(:post).returns(SERVER_GROUP_XML)
|
198
194
|
Connection.stubs(:get).returns(SERVER_GROUP_XML)
|
@@ -208,7 +204,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
208
204
|
|
209
205
|
def test_most_recent
|
210
206
|
|
211
|
-
File.open("#{ServerGroup.data_dir}/5.xml", 'w') do |f|
|
207
|
+
File.open("#{CloudCue::ServerGroup.data_dir}/5.xml", 'w') do |f|
|
212
208
|
f.write(SERVER_GROUP_XML)
|
213
209
|
end
|
214
210
|
|
@@ -224,7 +220,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
224
220
|
|
225
221
|
sg=ServerGroup.from_xml(SERVER_GROUP_XML)
|
226
222
|
assert sg.cache_to_disk
|
227
|
-
assert File.exists?(File.join(ServerGroup.data_dir, "#{sg.id}.xml"))
|
223
|
+
assert File.exists?(File.join(CloudCue::ServerGroup.data_dir, "#{sg.id}.xml"))
|
228
224
|
|
229
225
|
end
|
230
226
|
|
@@ -233,7 +229,7 @@ class ServerGroupTest < Test::Unit::TestCase
|
|
233
229
|
sg=ServerGroup.from_xml(SERVER_GROUP_XML)
|
234
230
|
Connection.stubs(:delete).returns("")
|
235
231
|
sg.delete
|
236
|
-
assert_equal false, File.exists?(File.join(ServerGroup.data_dir, "#{sg.id}.xml"))
|
232
|
+
assert_equal false, File.exists?(File.join(CloudCue::ServerGroup.data_dir, "#{sg.id}.xml"))
|
237
233
|
|
238
234
|
end
|
239
235
|
|
data/test/test_helper.rb
CHANGED
@@ -36,8 +36,6 @@ SERVER_GROUP_XML = %{
|
|
36
36
|
<owner-name>dan.prince</owner-name>
|
37
37
|
<updated-at type="datetime">2010-10-15T15:15:58-04:00</updated-at>
|
38
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
39
|
<servers type="array">
|
42
40
|
<server>
|
43
41
|
<account-id type="integer">3</account-id>
|
@@ -52,12 +50,11 @@ SERVER_GROUP_XML = %{
|
|
52
50
|
<image-id type="integer">14</image-id>
|
53
51
|
<internal-ip-addr>10.179.107.203</internal-ip-addr>
|
54
52
|
<name>login1</name>
|
55
|
-
<
|
53
|
+
<gateway type="boolean">true</gateway>
|
56
54
|
<retry-count type="integer">0</retry-count>
|
57
55
|
<server-group-id type="integer">1759</server-group-id>
|
58
56
|
<status>Online</status>
|
59
57
|
<updated-at type="datetime">2010-10-15T15:18:22-04:00</updated-at>
|
60
|
-
<vpn-network-interfaces type="array"/>
|
61
58
|
</server>
|
62
59
|
<server>
|
63
60
|
<account-id type="integer">3</account-id>
|
@@ -72,106 +69,16 @@ SERVER_GROUP_XML = %{
|
|
72
69
|
<image-id type="integer">49</image-id>
|
73
70
|
<internal-ip-addr>10.179.107.204</internal-ip-addr>
|
74
71
|
<name>test1</name>
|
75
|
-
<
|
72
|
+
<gateway type="boolean">false</gateway>
|
76
73
|
<retry-count type="integer">0</retry-count>
|
77
74
|
<server-group-id type="integer">1759</server-group-id>
|
78
75
|
<status>Online</status>
|
79
76
|
<updated-at type="datetime">2010-10-15T15:18:22-04:00</updated-at>
|
80
|
-
<vpn-network-interfaces type="array"/>
|
81
77
|
</server>
|
82
78
|
</servers>
|
83
79
|
</server-group>
|
84
80
|
}
|
85
81
|
|
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
|
-
<ca-cert>-----BEGIN CERTIFICATE-----
|
99
|
-
MIIDyDCCAzGgAwIBAgIJAORNZNRpPx87MA0GCSqGSIb3DQEBBQUAMIGfMQswCQYD
|
100
|
-
VQQGEwJVUzELMAkGA1UECBMCVkExEzARBgNVBAcTCkJsYWNrc2J1cmcxEjAQBgNV
|
101
|
-
BAoTCVJhY2tzcGFjZTEXMBUGA1UECxMOSW5mcmFzdHJ1Y3R1cmUxDjAMBgNVBAMT
|
102
|
-
BWxvZ2luMQ4wDAYDVQQpEwVsb2dpbjEhMB8GCSqGSIb3DQEJARYSY29icmFAc25h
|
103
|
-
a2VvaWwuY29tMB4XDTExMDExMDAwMzI1NVoXDTIxMDEwNzAwMzI1NVowgZ8xCzAJ
|
104
|
-
BgNVBAYTAlVTMQswCQYDVQQIEwJWQTETMBEGA1UEBxMKQmxhY2tzYnVyZzESMBAG
|
105
|
-
A1UEChMJUmFja3NwYWNlMRcwFQYDVQQLEw5JbmZyYXN0cnVjdHVyZTEOMAwGA1UE
|
106
|
-
AxMFbG9naW4xDjAMBgNVBCkTBWxvZ2luMSEwHwYJKoZIhvcNAQkBFhJjb2JyYUBz
|
107
|
-
bmFrZW9pbC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL0xIVIfh8rA
|
108
|
-
OCfc4BbWG+W+53iP9J6Fqhya5HSrYw3pdUCdimRBwQ0HoEnHndz2soRYc2Wtat8L
|
109
|
-
qqoS/qZMBbqerzEUFHumSKLADT3y8G1gkiGsb1fBZPmExPYyG/UQQUfK7CIM/L/m
|
110
|
-
W6Ji5ZEfTF9QPwHj3kVU99VUvm/BS8wXAgMBAAGjggEIMIIBBDAdBgNVHQ4EFgQU
|
111
|
-
dOvLRyxDa2Xso59PFLf22sZQ07wwgdQGA1UdIwSBzDCByYAUdOvLRyxDa2Xso59P
|
112
|
-
FLf22sZQ07yhgaWkgaIwgZ8xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJWQTETMBEG
|
113
|
-
A1UEBxMKQmxhY2tzYnVyZzESMBAGA1UEChMJUmFja3NwYWNlMRcwFQYDVQQLEw5J
|
114
|
-
bmZyYXN0cnVjdHVyZTEOMAwGA1UEAxMFbG9naW4xDjAMBgNVBCkTBWxvZ2luMSEw
|
115
|
-
HwYJKoZIhvcNAQkBFhJjb2JyYUBzbmFrZW9pbC5jb22CCQDkTWTUaT8fOzAMBgNV
|
116
|
-
HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAAVXIxOocwXi05004m9Znff6/cAj
|
117
|
-
2osr72g/Xux++lVqiSHf+T/R4QywsXy9//vKeXVEIyaaP9ImnWbbzHFFI+NStP4n
|
118
|
-
LILyv+/eOuZ6Dv7Vv6ZacjI3fexcXYr5VW52HHbb/M7G1ePAfdAixUHNH7lh58dY
|
119
|
-
WDzmJicksUYlyvI+
|
120
|
-
-----END CERTIFICATE-----
|
121
|
-
</ca-cert>
|
122
|
-
<client-cert>-----BEGIN CERTIFICATE-----
|
123
|
-
MIIEDjCCA3egAwIBAgIBAzANBgkqhkiG9w0BAQUFADC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pCbGFja3NidXJnMRIwEAYDVQQKEwlSYWNrc3BhY2UxFzAVBgNVBAsT
|
139
|
-
DkluZnJhc3RydWN0dXJlMQ4wDAYDVQQDEwVsb2dpbjEOMAwGA1UEKRMFbG9naW4x
|
140
|
-
ITAfBgkqhkiG9w0BCQEWEmNvYnJhQHNuYWtlb2lsLmNvbYIJAORNZNRpPx87MBMG
|
141
|
-
A1UdJQQMMAoGCCsGAQUFBwMCMAsGA1UdDwQEAwIHgDANBgkqhkiG9w0BAQUFAAOB
|
142
|
-
gQApPAG1suVSPugJyQGfBaL8H+7VJdAGXnc6INX5s1AxJ3mvp4o6PQ7ytP4v/QkJ
|
143
|
-
ZVMgWV8immfa3PboFgT00qqpbC2Vbf4RR972IEQfGuJLLl4YLrJsbloV9hBamKS7
|
144
|
-
Z1lllmEHxFWpNK2FLSZNaeQABZyvzfZYkk6zsHoY8XsCBg==
|
145
|
-
-----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
82
|
SERVER_XML = %{
|
176
83
|
|
177
84
|
<linux-server>
|
@@ -185,7 +92,7 @@ SERVER_XML = %{
|
|
185
92
|
<image-id type="integer">14</image-id>
|
186
93
|
<internal-ip-addr>10.119.225.116</internal-ip-addr>
|
187
94
|
<name>db1</name>
|
188
|
-
<
|
95
|
+
<gateway type="boolean">false</gateway>
|
189
96
|
<retry-count type="integer">0</retry-count>
|
190
97
|
<server-group-id type="integer">999</server-group-id>
|
191
98
|
<status>Online</status>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kytoon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
@@ -283,7 +283,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
283
283
|
version: '0'
|
284
284
|
segments:
|
285
285
|
- 0
|
286
|
-
hash:
|
286
|
+
hash: 3489483367199471003
|
287
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
288
|
none: false
|
289
289
|
requirements:
|