cloudstack_client 0.2.16 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cloudstack_client/commands/server.rb +21 -13
- data/lib/cloudstack_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51a94d65a1efd0ff25d7cdbc51627a62d25781b1
|
4
|
+
data.tar.gz: 84db0fba9cfa87d85be3f4c1affd7d25fd0b8f0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad0b46608886df58b30662b7a895d767504c6aaada4de03020f3ee101903454febd922cc8de87a7f8f5698f679618bd829d6af88b60ce9b65ced48782f99507c
|
7
|
+
data.tar.gz: 17b665a3290a0da0c67b5a220b42311f52878884a1b47de69480ef1c57f2800dfad43105be97fee9ea02aebb9ed87e25b164b4bc90294f10f35cb20bfb111bd2
|
@@ -5,12 +5,20 @@ module CloudstackClient
|
|
5
5
|
##
|
6
6
|
# Finds the server with the specified name.
|
7
7
|
|
8
|
-
def get_server(name,
|
8
|
+
def get_server(name, args = {})
|
9
9
|
params = {
|
10
10
|
'command' => 'listVirtualMachines',
|
11
11
|
'name' => name
|
12
12
|
}
|
13
|
-
params['projectid'] = project_id if project_id
|
13
|
+
params['projectid'] = args[:project_id] if args[:project_id]
|
14
|
+
|
15
|
+
if args[:account]
|
16
|
+
if account = list_accounts({name: args[:account]}).first
|
17
|
+
params['domainid'] = account["domainid"]
|
18
|
+
params['account'] = args[:account]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
14
22
|
json = send_request(params)
|
15
23
|
machines = json['virtualmachine']
|
16
24
|
|
@@ -236,8 +244,8 @@ module CloudstackClient
|
|
236
244
|
# Stops the server with the specified name.
|
237
245
|
#
|
238
246
|
|
239
|
-
def stop_server(name,
|
240
|
-
server = get_server(name,
|
247
|
+
def stop_server(name, args = {})
|
248
|
+
server = get_server(name, args)
|
241
249
|
if !server || !server['id']
|
242
250
|
puts "Error: Virtual machine '#{name}' does not exist"
|
243
251
|
exit 1
|
@@ -247,17 +255,17 @@ module CloudstackClient
|
|
247
255
|
'command' => 'stopVirtualMachine',
|
248
256
|
'id' => server['id']
|
249
257
|
}
|
250
|
-
params['forced'] = true if forced
|
258
|
+
params['forced'] = true if args[:forced]
|
251
259
|
|
252
|
-
async ? send_async_request(params)['virtualmachine'] : send_request(params)
|
260
|
+
args[:async] ? send_async_request(params)['virtualmachine'] : send_request(params)
|
253
261
|
end
|
254
262
|
|
255
263
|
##
|
256
264
|
# Start the server with the specified name.
|
257
265
|
#
|
258
266
|
|
259
|
-
def start_server(name,
|
260
|
-
server = get_server(name,
|
267
|
+
def start_server(name, args = {})
|
268
|
+
server = get_server(name, args)
|
261
269
|
if !server || !server['id']
|
262
270
|
puts "Error: Virtual machine '#{name}' does not exist"
|
263
271
|
exit 1
|
@@ -268,15 +276,15 @@ module CloudstackClient
|
|
268
276
|
'id' => server['id']
|
269
277
|
}
|
270
278
|
|
271
|
-
async ? send_async_request(params)['virtualmachine'] : send_request(params)
|
279
|
+
args[:async] ? send_async_request(params)['virtualmachine'] : send_request(params)
|
272
280
|
end
|
273
281
|
|
274
282
|
##
|
275
283
|
# Reboot the server with the specified name.
|
276
284
|
#
|
277
285
|
|
278
|
-
def reboot_server(name,
|
279
|
-
server = get_server(name,
|
286
|
+
def reboot_server(name, args = {})
|
287
|
+
server = get_server(name, args)
|
280
288
|
if !server || !server['id']
|
281
289
|
puts "Error: Virtual machine '#{name}' does not exist"
|
282
290
|
exit 1
|
@@ -287,7 +295,7 @@ module CloudstackClient
|
|
287
295
|
'id' => server['id']
|
288
296
|
}
|
289
297
|
|
290
|
-
async ? send_async_request(params)['virtualmachine'] : send_request(params)
|
298
|
+
args[:async] ? send_async_request(params)['virtualmachine'] : send_request(params)
|
291
299
|
end
|
292
300
|
|
293
301
|
##
|
@@ -299,7 +307,7 @@ module CloudstackClient
|
|
299
307
|
'command' => 'destroyVirtualMachine',
|
300
308
|
'id' => id
|
301
309
|
}
|
302
|
-
|
310
|
+
|
303
311
|
async ? send_async_request(params)['virtualmachine'] : send_request(params)
|
304
312
|
end
|
305
313
|
|