cloudstack_client 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9fbb45ce40bdb0236d5343c0cbc3b4c10db971d
4
- data.tar.gz: c5424aaf51e164f39ffec350e092cb66b0d0302e
3
+ metadata.gz: ffd63beb8ab67704569e056c8179fa7038ae5794
4
+ data.tar.gz: 26304d025eb85cce68304fec2cb4aa129fd89d94
5
5
  SHA512:
6
- metadata.gz: f188a35132d0fb2ddb6ab2751fbc520b80d270a7ab38904395410dbde12811a5120edd7c50cb0df27b2ca6b0e1c3bb8a3c2d69d9c72173475cb2470d2de39788
7
- data.tar.gz: dd9189799dee9b6b107ecbeda491f7eee3f0a687603b0dbf8f1888c526f9d960b1232ebead4f6ba36755db01a3b801feecffa1c7ed76e80cebfde79caea7c1ae
6
+ metadata.gz: 629ca9e1c0e1625020da16904cbef4fd922ac2e2acd08aff9daa9373e994524e156ed6b0e6ca1001db4cbb0771fd93b367daa00159c283ebe3b4dce18044025b
7
+ data.tar.gz: ec077e92e135282048b52432c865346bd0d4c97b38342d4c914602488d217db11c7f5ea6529beb993ef8f51dd2a699e417b202cf81dffb440d2c7035332f2598
data/README.md CHANGED
@@ -21,7 +21,7 @@ cs = CloudstackClient::Connection.new(
21
21
  'API_SECRET'
22
22
  )
23
23
 
24
- cs.list_servers(status: 'running').each do |server|
24
+ cs.list_servers(state: 'running').each do |server|
25
25
  puts server['name']
26
26
  end
27
27
  ```
@@ -11,8 +11,6 @@ module CloudstackClient
11
11
  'listAll' => true,
12
12
  'name' => name
13
13
  }
14
- params['projectid'] = args[:project_id] if args[:project_id]
15
-
16
14
 
17
15
  params['domainid'] = args[:domain_id] if args[:domain_id]
18
16
  if args[:account]
@@ -25,6 +23,18 @@ module CloudstackClient
25
23
  params['account'] = args[:account]
26
24
  end
27
25
 
26
+ if args[:project]
27
+ project = get_project(args[:project])
28
+ if !project
29
+ msg = "Project '#{args[:project]}' is invalid"
30
+ puts "Error: #{msg}"
31
+ exit 1
32
+ end
33
+ params['projectid'] = project['id']
34
+ elsif args[:project_id]
35
+ params['projectid'] = args[:project_id]
36
+ end
37
+
28
38
  json = send_request(params)
29
39
  machines = json['virtualmachine']
30
40
 
@@ -106,7 +116,7 @@ module CloudstackClient
106
116
  'command' => 'listVirtualMachines',
107
117
  'listAll' => true
108
118
  }
109
- params['projectid'] = args[:project_id] if args[:project_id]
119
+ params['state'] = args[:state] if args[:state]
110
120
  params['state'] = args[:status] if args[:status]
111
121
  params['groupid'] = args[:group_id] if args[:group_id]
112
122
 
@@ -129,6 +139,18 @@ module CloudstackClient
129
139
  params['account'] = args[:account]
130
140
  end
131
141
 
142
+ if args[:project]
143
+ project = get_project(args[:project])
144
+ if !project
145
+ msg = "Project '#{args[:project]}' is invalid"
146
+ puts "Error: #{msg}"
147
+ exit 1
148
+ end
149
+ params['projectid'] = project['id']
150
+ elsif args[:project_id]
151
+ params['projectid'] = args[:project_id]
152
+ end
153
+
132
154
  json = send_request(params)
133
155
  json['virtualmachine'] || []
134
156
  end
@@ -191,15 +213,6 @@ module CloudstackClient
191
213
  exit 1
192
214
  end
193
215
 
194
- if args[:project]
195
- project = get_project(args[:project])
196
- if !project
197
- msg = "Project '#{args[:project]}' is invalid"
198
- puts "Error: #{msg}"
199
- exit 1
200
- end
201
- end
202
-
203
216
  networks = []
204
217
  if args[:networks]
205
218
  args[:networks].each do |name|
@@ -230,7 +243,6 @@ module CloudstackClient
230
243
  'networkids' => network_ids.join(',')
231
244
  }
232
245
  params['name'] = args[:name] if args[:name]
233
- params['projectid'] = project['id'] if project
234
246
  params['diskofferingid'] = disk_offering['id'] if disk_offering
235
247
  params['hypervisor'] = (args[:hypervisor] || 'vmware') if iso
236
248
  params['keypair'] = args[:keypair] if args[:keypair]
@@ -248,6 +260,18 @@ module CloudstackClient
248
260
  params['account'] = args[:account]
249
261
  end
250
262
 
263
+ if args[:project]
264
+ project = get_project(args[:project])
265
+ if !project
266
+ msg = "Project '#{args[:project]}' is invalid"
267
+ puts "Error: #{msg}"
268
+ exit 1
269
+ end
270
+ params['projectid'] = project['id']
271
+ elsif args[:project_id]
272
+ params['projectid'] = args[:project_id]
273
+ end
274
+
251
275
  args[:sync] ? send_request(params) : send_async_request(params)['virtualmachine']
252
276
  end
253
277
 
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm