lib/cloudstack-client/commands/server.rb in cloudstack-cli-0.3.4 vs lib/cloudstack-client/commands/server.rb in cloudstack-cli-0.3.5

- old
+ new

@@ -191,11 +191,10 @@ end network_ids = networks.map { |network| network['id'] } - params = { 'command' => 'deployVirtualMachine', 'serviceOfferingId' => service['id'], 'templateId' => template ? template['id'] : iso['id'], 'zoneId' => zone['id'], @@ -218,12 +217,11 @@ end params['domainid'] = account["domainid"] params['account'] = args[:account] end - json = send_async_request(params) - json['virtualmachine'] + args[:sync] ? send_request(params) : send_async_request(params)['virtualmachine'] end ## # Stops the server with the specified name. # @@ -287,17 +285,16 @@ ## # Destroy the server with the specified name. # - def destroy_server(id) + def destroy_server(id, async = true) params = { 'command' => 'destroyVirtualMachine', 'id' => id } - json = send_async_request(params) - json['virtualmachine'] + async ? send_async_request(params)['virtualmachine'] : send_request(params) end end end \ No newline at end of file