kylichuku-grate-handle 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.md +54 -0
- data/README.rdoc +9 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/gh +8 -0
- data/grate-handle.gemspec +76 -0
- data/lib/cli_processor.rb +85 -0
- data/lib/gogrid_client.rb +44 -0
- data/lib/gogrid_manager.rb +61 -0
- data/lib/grate-handle.rb +11 -0
- data/lib/monkey_patches.rb +17 -0
- data/spec/cli_processor_spec.rb +61 -0
- data/spec/fixtures/all.rb +2 -0
- data/spec/fixtures/grid_server_list.json +60 -0
- data/spec/fixtures/grid_server_list.xml +571 -0
- data/spec/gogrid_manager_spec.rb +72 -0
- data/spec/monkey_patches_spec.rb +20 -0
- data/spec/spec_helper.rb +10 -0
- metadata +109 -0
@@ -0,0 +1,571 @@
|
|
1
|
+
<gogrid>
|
2
|
+
<response method="/grid/server/list" status="success">
|
3
|
+
<summary total="5" start="0" numpages="0" returned="5" />
|
4
|
+
<list>
|
5
|
+
<object name="server">
|
6
|
+
<attribute name="id">28940</attribute>
|
7
|
+
<attribute name="name">bebebe_grid</attribute>
|
8
|
+
<attribute name="description"></attribute>
|
9
|
+
<attribute name="ip">
|
10
|
+
<object name="ip">
|
11
|
+
<attribute name="id">619894</attribute>
|
12
|
+
<attribute name="ip">173.1.54.221</attribute>
|
13
|
+
<attribute name="state">
|
14
|
+
<object name="option">
|
15
|
+
<attribute name="id">2</attribute>
|
16
|
+
<attribute name="name">Assigned</attribute>
|
17
|
+
<attribute name="description">IP is reserved or in use</attribute>
|
18
|
+
</object>
|
19
|
+
</attribute>
|
20
|
+
<attribute name="subnet">173.1.54.208/255.255.255.240</attribute>
|
21
|
+
<attribute name="public">true</attribute>
|
22
|
+
</object>
|
23
|
+
</attribute>
|
24
|
+
<attribute name="ram">
|
25
|
+
<object name="option">
|
26
|
+
<attribute name="id">3</attribute>
|
27
|
+
<attribute name="name">2GB</attribute>
|
28
|
+
<attribute name="description">Server with 2GB RAM</attribute>
|
29
|
+
</object>
|
30
|
+
</attribute>
|
31
|
+
<attribute name="image">
|
32
|
+
<object name="serverimage">
|
33
|
+
<attribute name="id">64</attribute>
|
34
|
+
<attribute name="friendlyName">RHEL 5.1 (32-bit) w/
|
35
|
+
Appistry</attribute>
|
36
|
+
<attribute name="name">rhel51_32_appistry</attribute>
|
37
|
+
<attribute name="os">
|
38
|
+
<object name="option">
|
39
|
+
<attribute name="id">15</attribute>
|
40
|
+
<attribute name="name">RHEL 5.1 (32-bit)</attribute>
|
41
|
+
<attribute name="description">RHEL 5.1 (32-bit)</attribute>
|
42
|
+
</object>
|
43
|
+
</attribute>
|
44
|
+
<attribute name="architecture">
|
45
|
+
<object name="option">
|
46
|
+
<attribute name="id">1</attribute>
|
47
|
+
<attribute name="name">32-bit</attribute>
|
48
|
+
<attribute name="description">32 bit OS</attribute>
|
49
|
+
</object>
|
50
|
+
</attribute>
|
51
|
+
<attribute name="owner">
|
52
|
+
<object name="customer">
|
53
|
+
<attribute name="id">-1</attribute>
|
54
|
+
<attribute name="name">GoGrid</attribute>
|
55
|
+
</object>
|
56
|
+
</attribute>
|
57
|
+
<attribute name="type">
|
58
|
+
<object name="option">
|
59
|
+
<attribute name="id">1</attribute>
|
60
|
+
<attribute name="name">Web Server</attribute>
|
61
|
+
<attribute name="description">Web or Application Server</attribute>
|
62
|
+
</object>
|
63
|
+
</attribute>
|
64
|
+
<attribute name="state">
|
65
|
+
<object name="option">
|
66
|
+
<attribute name="id">2</attribute>
|
67
|
+
<attribute name="name">Available</attribute>
|
68
|
+
<attribute name="description">Image is available for
|
69
|
+
adds</attribute>
|
70
|
+
</object>
|
71
|
+
</attribute>
|
72
|
+
<attribute name="description">RHEL 5.1 (32-bit) w/
|
73
|
+
Appistry</attribute>
|
74
|
+
<attribute name="location">
|
75
|
+
gogrid/rhel51_32_appistry.img</attribute>
|
76
|
+
<attribute name="price">0.0</attribute>
|
77
|
+
<attribute name="isActive">true</attribute>
|
78
|
+
<attribute name="isPublic">true</attribute>
|
79
|
+
<attribute name="createdTime">1235548800000</attribute>
|
80
|
+
<attribute name="updatedTime">1246000000000</attribute>
|
81
|
+
<attribute name="billingtokens">
|
82
|
+
<list>
|
83
|
+
<object name="billingtoken">
|
84
|
+
<attribute name="id">40</attribute>
|
85
|
+
<attribute name="name">RHEL 5.1 32bit</attribute>
|
86
|
+
<attribute name="price">0.0</attribute>
|
87
|
+
</object>
|
88
|
+
<object name="billingtoken">
|
89
|
+
<attribute name="id">27</attribute>
|
90
|
+
<attribute name="name">Appistry 32-bit</attribute>
|
91
|
+
<attribute name="price">0.0</attribute>
|
92
|
+
</object>
|
93
|
+
</list>
|
94
|
+
</attribute>
|
95
|
+
</object>
|
96
|
+
</attribute>
|
97
|
+
<attribute name="state">
|
98
|
+
<object name="option">
|
99
|
+
<attribute name="id">1</attribute>
|
100
|
+
<attribute name="name">Started</attribute>
|
101
|
+
<attribute name="description">Server is in active
|
102
|
+
state.</attribute>
|
103
|
+
</object>
|
104
|
+
</attribute>
|
105
|
+
<attribute name="type">
|
106
|
+
<object name="option">
|
107
|
+
<attribute name="id">1</attribute>
|
108
|
+
<attribute name="name">Web Server</attribute>
|
109
|
+
<attribute name="description">Web or Application Server</attribute>
|
110
|
+
</object>
|
111
|
+
</attribute>
|
112
|
+
<attribute name="os">
|
113
|
+
<object name="option">
|
114
|
+
<attribute name="id">15</attribute>
|
115
|
+
<attribute name="name">RHEL 5.1 (32-bit)</attribute>
|
116
|
+
<attribute name="description">RHEL 5.1 (32-bit)</attribute>
|
117
|
+
</object>
|
118
|
+
</attribute>
|
119
|
+
<attribute name="isSandbox">false</attribute>
|
120
|
+
</object>
|
121
|
+
<object name="server">
|
122
|
+
<attribute name="id">28941</attribute>
|
123
|
+
<attribute name="name">bebebe_mcom</attribute>
|
124
|
+
<attribute name="description"></attribute>
|
125
|
+
<attribute name="ip">
|
126
|
+
<object name="ip">
|
127
|
+
<attribute name="id">619884</attribute>
|
128
|
+
<attribute name="ip">173.1.54.211</attribute>
|
129
|
+
<attribute name="state">
|
130
|
+
<object name="option">
|
131
|
+
<attribute name="id">2</attribute>
|
132
|
+
<attribute name="name">Assigned</attribute>
|
133
|
+
<attribute name="description">IP is reserved or in use</attribute>
|
134
|
+
</object>
|
135
|
+
</attribute>
|
136
|
+
<attribute name="subnet">173.1.54.208/255.255.255.240</attribute>
|
137
|
+
<attribute name="public">true</attribute>
|
138
|
+
</object>
|
139
|
+
</attribute>
|
140
|
+
<attribute name="ram">
|
141
|
+
<object name="option">
|
142
|
+
<attribute name="id">3</attribute>
|
143
|
+
<attribute name="name">2GB</attribute>
|
144
|
+
<attribute name="description">Server with 2GB RAM</attribute>
|
145
|
+
</object>
|
146
|
+
</attribute>
|
147
|
+
<attribute name="image">
|
148
|
+
<object name="serverimage">
|
149
|
+
<attribute name="id">64</attribute>
|
150
|
+
<attribute name="friendlyName">RHEL 5.1 (32-bit) w/
|
151
|
+
Appistry</attribute>
|
152
|
+
<attribute name="name">rhel51_32_appistry</attribute>
|
153
|
+
<attribute name="os">
|
154
|
+
<object name="option">
|
155
|
+
<attribute name="id">15</attribute>
|
156
|
+
<attribute name="name">RHEL 5.1 (32-bit)</attribute>
|
157
|
+
<attribute name="description">RHEL 5.1 (32-bit)</attribute>
|
158
|
+
</object>
|
159
|
+
</attribute>
|
160
|
+
<attribute name="architecture">
|
161
|
+
<object name="option">
|
162
|
+
<attribute name="id">1</attribute>
|
163
|
+
<attribute name="name">32-bit</attribute>
|
164
|
+
<attribute name="description">32 bit OS</attribute>
|
165
|
+
</object>
|
166
|
+
</attribute>
|
167
|
+
<attribute name="owner">
|
168
|
+
<object name="customer">
|
169
|
+
<attribute name="id">-1</attribute>
|
170
|
+
<attribute name="name">GoGrid</attribute>
|
171
|
+
</object>
|
172
|
+
</attribute>
|
173
|
+
<attribute name="type">
|
174
|
+
<object name="option">
|
175
|
+
<attribute name="id">1</attribute>
|
176
|
+
<attribute name="name">Web Server</attribute>
|
177
|
+
<attribute name="description">Web or Application Server</attribute>
|
178
|
+
</object>
|
179
|
+
</attribute>
|
180
|
+
<attribute name="state">
|
181
|
+
<object name="option">
|
182
|
+
<attribute name="id">2</attribute>
|
183
|
+
<attribute name="name">Available</attribute>
|
184
|
+
<attribute name="description">Image is available for
|
185
|
+
adds</attribute>
|
186
|
+
</object>
|
187
|
+
</attribute>
|
188
|
+
<attribute name="description">RHEL 5.1 (32-bit) w/
|
189
|
+
Appistry</attribute>
|
190
|
+
<attribute name="location">
|
191
|
+
gogrid/rhel51_32_appistry.img</attribute>
|
192
|
+
<attribute name="price">0.0</attribute>
|
193
|
+
<attribute name="isActive">true</attribute>
|
194
|
+
<attribute name="isPublic">true</attribute>
|
195
|
+
<attribute name="createdTime">1235548800000</attribute>
|
196
|
+
<attribute name="updatedTime">1246000000000</attribute>
|
197
|
+
<attribute name="billingtokens">
|
198
|
+
<list>
|
199
|
+
<object name="billingtoken">
|
200
|
+
<attribute name="id">40</attribute>
|
201
|
+
<attribute name="name">RHEL 5.1 32bit</attribute>
|
202
|
+
<attribute name="price">0.0</attribute>
|
203
|
+
</object>
|
204
|
+
<object name="billingtoken">
|
205
|
+
<attribute name="id">27</attribute>
|
206
|
+
<attribute name="name">Appistry 32-bit</attribute>
|
207
|
+
<attribute name="price">0.0</attribute>
|
208
|
+
</object>
|
209
|
+
</list>
|
210
|
+
</attribute>
|
211
|
+
</object>
|
212
|
+
</attribute>
|
213
|
+
<attribute name="state">
|
214
|
+
<object name="option">
|
215
|
+
<attribute name="id">1</attribute>
|
216
|
+
<attribute name="name">Started</attribute>
|
217
|
+
<attribute name="description">Server is in active
|
218
|
+
state.</attribute>
|
219
|
+
</object>
|
220
|
+
</attribute>
|
221
|
+
<attribute name="type">
|
222
|
+
<object name="option">
|
223
|
+
<attribute name="id">1</attribute>
|
224
|
+
<attribute name="name">Web Server</attribute>
|
225
|
+
<attribute name="description">Web or Application Server</attribute>
|
226
|
+
</object>
|
227
|
+
</attribute>
|
228
|
+
<attribute name="os">
|
229
|
+
<object name="option">
|
230
|
+
<attribute name="id">15</attribute>
|
231
|
+
<attribute name="name">RHEL 5.1 (32-bit)</attribute>
|
232
|
+
<attribute name="description">RHEL 5.1 (32-bit)</attribute>
|
233
|
+
</object>
|
234
|
+
</attribute>
|
235
|
+
<attribute name="isSandbox">false</attribute>
|
236
|
+
</object>
|
237
|
+
<object name="server">
|
238
|
+
<attribute name="id">31701</attribute>
|
239
|
+
<attribute name="name">gd-photon-pg</attribute>
|
240
|
+
<attribute name="description"></attribute>
|
241
|
+
<attribute name="ip">
|
242
|
+
<object name="ip">
|
243
|
+
<attribute name="id">619892</attribute>
|
244
|
+
<attribute name="ip">173.1.54.219</attribute>
|
245
|
+
<attribute name="state">
|
246
|
+
<object name="option">
|
247
|
+
<attribute name="id">2</attribute>
|
248
|
+
<attribute name="name">Assigned</attribute>
|
249
|
+
<attribute name="description">IP is reserved or in use</attribute>
|
250
|
+
</object>
|
251
|
+
</attribute>
|
252
|
+
<attribute name="subnet">173.1.54.208/255.255.255.240</attribute>
|
253
|
+
<attribute name="public">true</attribute>
|
254
|
+
</object>
|
255
|
+
</attribute>
|
256
|
+
<attribute name="ram">
|
257
|
+
<object name="option">
|
258
|
+
<attribute name="id">4</attribute>
|
259
|
+
<attribute name="name">4GB</attribute>
|
260
|
+
<attribute name="description">Server with 4GB RAM</attribute>
|
261
|
+
</object>
|
262
|
+
</attribute>
|
263
|
+
<attribute name="image">
|
264
|
+
<object name="serverimage">
|
265
|
+
<attribute name="id">25</attribute>
|
266
|
+
<attribute name="friendlyName">CentOS 5.1 (64-bit) w/ Apache 2.2 +
|
267
|
+
PHP 5.1</attribute>
|
268
|
+
<attribute name="name">centos51_64_php</attribute>
|
269
|
+
<attribute name="os">
|
270
|
+
<object name="option">
|
271
|
+
<attribute name="id">10</attribute>
|
272
|
+
<attribute name="name">CentOS 5.1 (64-bit)</attribute>
|
273
|
+
<attribute name="description">CentOS Linux 5.1 (64-bit)</attribute>
|
274
|
+
</object>
|
275
|
+
</attribute>
|
276
|
+
<attribute name="architecture">
|
277
|
+
<object name="option">
|
278
|
+
<attribute name="id">2</attribute>
|
279
|
+
<attribute name="name">64-bit</attribute>
|
280
|
+
<attribute name="description">64 bit OS</attribute>
|
281
|
+
</object>
|
282
|
+
</attribute>
|
283
|
+
<attribute name="owner">
|
284
|
+
<object name="customer">
|
285
|
+
<attribute name="id">-1</attribute>
|
286
|
+
<attribute name="name">GoGrid</attribute>
|
287
|
+
</object>
|
288
|
+
</attribute>
|
289
|
+
<attribute name="type">
|
290
|
+
<object name="option">
|
291
|
+
<attribute name="id">1</attribute>
|
292
|
+
<attribute name="name">Web Server</attribute>
|
293
|
+
<attribute name="description">Web or Application Server</attribute>
|
294
|
+
</object>
|
295
|
+
</attribute>
|
296
|
+
<attribute name="state">
|
297
|
+
<object name="option">
|
298
|
+
<attribute name="id">2</attribute>
|
299
|
+
<attribute name="name">Available</attribute>
|
300
|
+
<attribute name="description">Image is available for
|
301
|
+
adds</attribute>
|
302
|
+
</object>
|
303
|
+
</attribute>
|
304
|
+
<attribute name="description">CentOS 5.1 (64-bit) w/ Apache 2.2 +
|
305
|
+
PHP 5.1</attribute>
|
306
|
+
<attribute name="location">gogrid/centos51_64_php.img</attribute>
|
307
|
+
<attribute name="price">0.0</attribute>
|
308
|
+
<attribute name="isActive">true</attribute>
|
309
|
+
<attribute name="isPublic">true</attribute>
|
310
|
+
<attribute name="createdTime">1212044400000</attribute>
|
311
|
+
<attribute name="updatedTime">1246000000000</attribute>
|
312
|
+
<attribute name="billingtokens">
|
313
|
+
<list>
|
314
|
+
<object name="billingtoken">
|
315
|
+
<attribute name="id">21</attribute>
|
316
|
+
<attribute name="name">CentOS 5.1 64bit</attribute>
|
317
|
+
<attribute name="price">0.0</attribute>
|
318
|
+
</object>
|
319
|
+
</list>
|
320
|
+
</attribute>
|
321
|
+
</object>
|
322
|
+
</attribute>
|
323
|
+
<attribute name="state">
|
324
|
+
<object name="option">
|
325
|
+
<attribute name="id">1</attribute>
|
326
|
+
<attribute name="name">Started</attribute>
|
327
|
+
<attribute name="description">Server is in active
|
328
|
+
state.</attribute>
|
329
|
+
</object>
|
330
|
+
</attribute>
|
331
|
+
<attribute name="type">
|
332
|
+
<object name="option">
|
333
|
+
<attribute name="id">1</attribute>
|
334
|
+
<attribute name="name">Web Server</attribute>
|
335
|
+
<attribute name="description">Web or Application Server</attribute>
|
336
|
+
</object>
|
337
|
+
</attribute>
|
338
|
+
<attribute name="os">
|
339
|
+
<object name="option">
|
340
|
+
<attribute name="id">10</attribute>
|
341
|
+
<attribute name="name">CentOS 5.1 (64-bit)</attribute>
|
342
|
+
<attribute name="description">CentOS Linux 5.1 (64-bit)</attribute>
|
343
|
+
</object>
|
344
|
+
</attribute>
|
345
|
+
<attribute name="isSandbox">false</attribute>
|
346
|
+
</object>
|
347
|
+
<object name="server">
|
348
|
+
<attribute name="id">35181</attribute>
|
349
|
+
<attribute name="name">db2</attribute>
|
350
|
+
<attribute name="description"></attribute>
|
351
|
+
<attribute name="ip">
|
352
|
+
<object name="ip">
|
353
|
+
<attribute name="id">619891</attribute>
|
354
|
+
<attribute name="ip">173.1.54.218</attribute>
|
355
|
+
<attribute name="state">
|
356
|
+
<object name="option">
|
357
|
+
<attribute name="id">2</attribute>
|
358
|
+
<attribute name="name">Assigned</attribute>
|
359
|
+
<attribute name="description">IP is reserved or in use</attribute>
|
360
|
+
</object>
|
361
|
+
</attribute>
|
362
|
+
<attribute name="subnet">173.1.54.208/255.255.255.240</attribute>
|
363
|
+
<attribute name="public">true</attribute>
|
364
|
+
</object>
|
365
|
+
</attribute>
|
366
|
+
<attribute name="ram">
|
367
|
+
<object name="option">
|
368
|
+
<attribute name="id">4</attribute>
|
369
|
+
<attribute name="name">4GB</attribute>
|
370
|
+
<attribute name="description">Server with 4GB RAM</attribute>
|
371
|
+
</object>
|
372
|
+
</attribute>
|
373
|
+
<attribute name="image">
|
374
|
+
<object name="serverimage">
|
375
|
+
<attribute name="id">24</attribute>
|
376
|
+
<attribute name="friendlyName">CentOS 5.1 (64-bit) w/ Apache
|
377
|
+
2.2</attribute>
|
378
|
+
<attribute name="name">centos51_64_apache</attribute>
|
379
|
+
<attribute name="os">
|
380
|
+
<object name="option">
|
381
|
+
<attribute name="id">10</attribute>
|
382
|
+
<attribute name="name">CentOS 5.1 (64-bit)</attribute>
|
383
|
+
<attribute name="description">CentOS Linux 5.1 (64-bit)</attribute>
|
384
|
+
</object>
|
385
|
+
</attribute>
|
386
|
+
<attribute name="architecture">
|
387
|
+
<object name="option">
|
388
|
+
<attribute name="id">2</attribute>
|
389
|
+
<attribute name="name">64-bit</attribute>
|
390
|
+
<attribute name="description">64 bit OS</attribute>
|
391
|
+
</object>
|
392
|
+
</attribute>
|
393
|
+
<attribute name="owner">
|
394
|
+
<object name="customer">
|
395
|
+
<attribute name="id">-1</attribute>
|
396
|
+
<attribute name="name">GoGrid</attribute>
|
397
|
+
</object>
|
398
|
+
</attribute>
|
399
|
+
<attribute name="type">
|
400
|
+
<object name="option">
|
401
|
+
<attribute name="id">1</attribute>
|
402
|
+
<attribute name="name">Web Server</attribute>
|
403
|
+
<attribute name="description">Web or Application Server</attribute>
|
404
|
+
</object>
|
405
|
+
</attribute>
|
406
|
+
<attribute name="state">
|
407
|
+
<object name="option">
|
408
|
+
<attribute name="id">2</attribute>
|
409
|
+
<attribute name="name">Available</attribute>
|
410
|
+
<attribute name="description">Image is available for
|
411
|
+
adds</attribute>
|
412
|
+
</object>
|
413
|
+
</attribute>
|
414
|
+
<attribute name="description">CentOS 5.1 (64-bit) w/ Apache
|
415
|
+
2.2</attribute>
|
416
|
+
<attribute name="location">
|
417
|
+
gogrid/centos51_64_apache.img</attribute>
|
418
|
+
<attribute name="price">0.0</attribute>
|
419
|
+
<attribute name="isActive">true</attribute>
|
420
|
+
<attribute name="isPublic">true</attribute>
|
421
|
+
<attribute name="createdTime">1212044400000</attribute>
|
422
|
+
<attribute name="updatedTime">1246000000000</attribute>
|
423
|
+
<attribute name="billingtokens">
|
424
|
+
<list>
|
425
|
+
<object name="billingtoken">
|
426
|
+
<attribute name="id">21</attribute>
|
427
|
+
<attribute name="name">CentOS 5.1 64bit</attribute>
|
428
|
+
<attribute name="price">0.0</attribute>
|
429
|
+
</object>
|
430
|
+
</list>
|
431
|
+
</attribute>
|
432
|
+
</object>
|
433
|
+
</attribute>
|
434
|
+
<attribute name="state">
|
435
|
+
<object name="option">
|
436
|
+
<attribute name="id">1</attribute>
|
437
|
+
<attribute name="name">Started</attribute>
|
438
|
+
<attribute name="description">Server is in active
|
439
|
+
state.</attribute>
|
440
|
+
</object>
|
441
|
+
</attribute>
|
442
|
+
<attribute name="type">
|
443
|
+
<object name="option">
|
444
|
+
<attribute name="id">1</attribute>
|
445
|
+
<attribute name="name">Web Server</attribute>
|
446
|
+
<attribute name="description">Web or Application Server</attribute>
|
447
|
+
</object>
|
448
|
+
</attribute>
|
449
|
+
<attribute name="os">
|
450
|
+
<object name="option">
|
451
|
+
<attribute name="id">10</attribute>
|
452
|
+
<attribute name="name">CentOS 5.1 (64-bit)</attribute>
|
453
|
+
<attribute name="description">CentOS Linux 5.1 (64-bit)</attribute>
|
454
|
+
</object>
|
455
|
+
</attribute>
|
456
|
+
<attribute name="isSandbox">false</attribute>
|
457
|
+
</object>
|
458
|
+
<object name="server">
|
459
|
+
<attribute name="id">38105</attribute>
|
460
|
+
<attribute name="name">brz-tomcat-sprdm-1</attribute>
|
461
|
+
<attribute name="description"></attribute>
|
462
|
+
<attribute name="ip">
|
463
|
+
<object name="ip">
|
464
|
+
<attribute name="id">1312606</attribute>
|
465
|
+
<attribute name="ip">64.151.85.190</attribute>
|
466
|
+
<attribute name="state">
|
467
|
+
<object name="option">
|
468
|
+
<attribute name="id">2</attribute>
|
469
|
+
<attribute name="name">Assigned</attribute>
|
470
|
+
<attribute name="description">IP is reserved or in use</attribute>
|
471
|
+
</object>
|
472
|
+
</attribute>
|
473
|
+
<attribute name="subnet">64.151.85.176/255.255.255.240</attribute>
|
474
|
+
<attribute name="public">true</attribute>
|
475
|
+
</object>
|
476
|
+
</attribute>
|
477
|
+
<attribute name="ram">
|
478
|
+
<object name="option">
|
479
|
+
<attribute name="id">4</attribute>
|
480
|
+
<attribute name="name">4GB</attribute>
|
481
|
+
<attribute name="description">Server with 4GB RAM</attribute>
|
482
|
+
</object>
|
483
|
+
</attribute>
|
484
|
+
<attribute name="image">
|
485
|
+
<object name="serverimage">
|
486
|
+
<attribute name="id">24</attribute>
|
487
|
+
<attribute name="friendlyName">CentOS 5.1 (64-bit) w/ Apache
|
488
|
+
2.2</attribute>
|
489
|
+
<attribute name="name">centos51_64_apache</attribute>
|
490
|
+
<attribute name="os">
|
491
|
+
<object name="option">
|
492
|
+
<attribute name="id">10</attribute>
|
493
|
+
<attribute name="name">CentOS 5.1 (64-bit)</attribute>
|
494
|
+
<attribute name="description">CentOS Linux 5.1 (64-bit)</attribute>
|
495
|
+
</object>
|
496
|
+
</attribute>
|
497
|
+
<attribute name="architecture">
|
498
|
+
<object name="option">
|
499
|
+
<attribute name="id">2</attribute>
|
500
|
+
<attribute name="name">64-bit</attribute>
|
501
|
+
<attribute name="description">64 bit OS</attribute>
|
502
|
+
</object>
|
503
|
+
</attribute>
|
504
|
+
<attribute name="owner">
|
505
|
+
<object name="customer">
|
506
|
+
<attribute name="id">-1</attribute>
|
507
|
+
<attribute name="name">GoGrid</attribute>
|
508
|
+
</object>
|
509
|
+
</attribute>
|
510
|
+
<attribute name="type">
|
511
|
+
<object name="option">
|
512
|
+
<attribute name="id">1</attribute>
|
513
|
+
<attribute name="name">Web Server</attribute>
|
514
|
+
<attribute name="description">Web or Application Server</attribute>
|
515
|
+
</object>
|
516
|
+
</attribute>
|
517
|
+
<attribute name="state">
|
518
|
+
<object name="option">
|
519
|
+
<attribute name="id">2</attribute>
|
520
|
+
<attribute name="name">Available</attribute>
|
521
|
+
<attribute name="description">Image is available for
|
522
|
+
adds</attribute>
|
523
|
+
</object>
|
524
|
+
</attribute>
|
525
|
+
<attribute name="description">CentOS 5.1 (64-bit) w/ Apache
|
526
|
+
2.2</attribute>
|
527
|
+
<attribute name="location">
|
528
|
+
gogrid/centos51_64_apache.img</attribute>
|
529
|
+
<attribute name="price">0.0</attribute>
|
530
|
+
<attribute name="isActive">true</attribute>
|
531
|
+
<attribute name="isPublic">true</attribute>
|
532
|
+
<attribute name="createdTime">1212044400000</attribute>
|
533
|
+
<attribute name="updatedTime">1246000000000</attribute>
|
534
|
+
<attribute name="billingtokens">
|
535
|
+
<list>
|
536
|
+
<object name="billingtoken">
|
537
|
+
<attribute name="id">21</attribute>
|
538
|
+
<attribute name="name">CentOS 5.1 64bit</attribute>
|
539
|
+
<attribute name="price">0.0</attribute>
|
540
|
+
</object>
|
541
|
+
</list>
|
542
|
+
</attribute>
|
543
|
+
</object>
|
544
|
+
</attribute>
|
545
|
+
<attribute name="state">
|
546
|
+
<object name="option">
|
547
|
+
<attribute name="id">1</attribute>
|
548
|
+
<attribute name="name">Started</attribute>
|
549
|
+
<attribute name="description">Server is in active
|
550
|
+
state.</attribute>
|
551
|
+
</object>
|
552
|
+
</attribute>
|
553
|
+
<attribute name="type">
|
554
|
+
<object name="option">
|
555
|
+
<attribute name="id">1</attribute>
|
556
|
+
<attribute name="name">Web Server</attribute>
|
557
|
+
<attribute name="description">Web or Application Server</attribute>
|
558
|
+
</object>
|
559
|
+
</attribute>
|
560
|
+
<attribute name="os">
|
561
|
+
<object name="option">
|
562
|
+
<attribute name="id">10</attribute>
|
563
|
+
<attribute name="name">CentOS 5.1 (64-bit)</attribute>
|
564
|
+
<attribute name="description">CentOS Linux 5.1 (64-bit)</attribute>
|
565
|
+
</object>
|
566
|
+
</attribute>
|
567
|
+
<attribute name="isSandbox">false</attribute>
|
568
|
+
</object>
|
569
|
+
</list>
|
570
|
+
</response>
|
571
|
+
</gogrid>
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe GoGridManager do
|
4
|
+
# {{{1 GoGridManager initialization
|
5
|
+
|
6
|
+
describe "when creating a manager" do
|
7
|
+
before do
|
8
|
+
stub(File).read(File.expand_path("~/.ghrc")) { "config dump" }
|
9
|
+
stub(YAML).load("config dump") { config_data }
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should create a GoGridClient with given to manager credentials" do
|
13
|
+
mock(GoGridClient).new("key", "secret")
|
14
|
+
manager = GoGridManager.new("key", "secret")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should load config for 1st account from ~/.ghrc if no params given" do
|
18
|
+
mock(File).read(File.expand_path("~/.ghrc")) { "config dump" }
|
19
|
+
mock(YAML).load("config dump") { config_data }
|
20
|
+
mock(GoGridClient).new('key', 'secret')
|
21
|
+
manager = GoGridManager.new()
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should load config for given account if this data presents in config" do
|
25
|
+
mock(GoGridClient).new("key2", "secret2")
|
26
|
+
manager = GoGridManager.new("acc2", nil)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def config_data
|
32
|
+
[
|
33
|
+
{'account' => "acc", 'apikey' => "key", 'secret' => "secret"},
|
34
|
+
{'account' => "acc2", 'apikey' => "key2", 'secret' => "secret2"},
|
35
|
+
{'account' => "acc3", 'apikey' => "key3", 'secret' => "secret3"}
|
36
|
+
]
|
37
|
+
end
|
38
|
+
|
39
|
+
# }}}
|
40
|
+
# {{{1 list_servers methods
|
41
|
+
describe "when calling list_servers" do
|
42
|
+
before do
|
43
|
+
@manager = GoGridManager.new("key", "secret")
|
44
|
+
stub(@manager.client).send_api_request("grid/server/list", {}) { SERVERS }
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should send grid/server/list request" do
|
48
|
+
mock(@manager.client).send_api_request("grid/server/list", {}) { SERVERS }
|
49
|
+
@manager.list_servers
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should parse JSON from response" do
|
53
|
+
hash = {}
|
54
|
+
mock(JSON).parse(SERVERS) { hash }
|
55
|
+
stub(hash).list
|
56
|
+
@manager.list_servers
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should return an array of servers" do
|
60
|
+
@manager.list_servers.should be_instance_of(Array)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should return non-empty array for given fixture" do
|
64
|
+
@manager.list_servers.should_not be_empty
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should have a Sandbox Server as a first server in response" do
|
68
|
+
@manager.list_servers.first.name.should == "Sandbox Server"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
# }}}
|
72
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Hash do
|
4
|
+
it "should allow to access hash value via dot notation" do
|
5
|
+
h = { 'key' => 'value' }
|
6
|
+
h.key.should == 'value'
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should not patch symbol keys" do
|
10
|
+
h = { :key => 'value' }
|
11
|
+
|
12
|
+
lambda { h.key.should == 'value' }.should raise_error(NoMethodError)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should access to caleCase named keys using gnu_style accessor" do
|
16
|
+
h = { 'camelCasedKey' => 42 }
|
17
|
+
h.camel_cased_key.should == 42
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|