cloudstack-cli 1.0.7 → 1.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 876fe294818f0d84f011416a71de1605f0a524c1
4
- data.tar.gz: 7006b7e86331e87eae113a50b2874ce9fb6e8d2b
3
+ metadata.gz: 679d16d7fc4a542b3c7688838fb8060f8d080af0
4
+ data.tar.gz: 06e2eedaa8a3657c6c9c178bee2177b931d1961e
5
5
  SHA512:
6
- metadata.gz: ef8c9130515ac72cc3980fcece0888010c08e812adae6f5fb845a9495d5d9da4feb9a30e00a8820d55ca8ecb164da0bd479e1e5f6257c8260899c0f046c87425
7
- data.tar.gz: ae75e18b13014a2347a3e41c166d790667d27ceceaf7425e1a264dced5b3f0a86f2de57aaf388b0b89cd7628ecf84e97aef67b0385f1bbbbeb675a3ff5243adc
6
+ metadata.gz: fb62fe90ba957a0db37f4509bed59dd620f29c0afec8fe97b5d0ad94baffb15ce9c2f33e488914c8fad0e412731c734e34551641df9e77be20d667d8dc490e8d
7
+ data.tar.gz: bdab190dd7921c9a5e027edfb8a0eb93036f9eb32eb16385840113e316df82364ef5053ac7bf0d0b517fedd54341a88e35390a5ad24de41c0fb0cc11162dd934
data/Gemfile.lock CHANGED
@@ -29,4 +29,4 @@ DEPENDENCIES
29
29
  rdoc (~> 4.2)
30
30
 
31
31
  BUNDLED WITH
32
- 1.10.5
32
+ 1.10.6
@@ -9,6 +9,7 @@ class VirtualMachine < CloudstackCli::Base
9
9
  option :state, desc: "state of the virtual machine"
10
10
  option :listall, desc: "list all virtual machines", default: true
11
11
  option :storage_id, desc: "the storage ID where vm's volumes belong to"
12
+ option :host, desc: "the name of the hypervisor host the VM belong to"
12
13
  option :keyword, desc: "filter by keyword"
13
14
  option :command,
14
15
  desc: "command to execute for the given virtual machines",
@@ -21,6 +22,7 @@ class VirtualMachine < CloudstackCli::Base
21
22
  resolve_account
22
23
  resolve_project
23
24
  resolve_zone
25
+ resolve_host
24
26
  command = options[:command].downcase if options[:command]
25
27
  options.delete(:command)
26
28
  virtual_machines = client.list_virtual_machines(options)
@@ -206,8 +208,10 @@ class VirtualMachine < CloudstackCli::Base
206
208
  say JSON.pretty_generate(virtual_machines: virtual_machines)
207
209
  else
208
210
  with_i_name = virtual_machines.first['instancename']
211
+ with_h_name = virtual_machines.first['hostname']
209
212
  table = [["Name", "State", "Offering", "Zone", options[:project_id] ? "Project" : "Account", "IP's"]]
210
213
  table.first.insert(1, "Instance-Name") if with_i_name
214
+ table.first.insert(-1, "Host-Name") if with_h_name
211
215
  virtual_machines.each do |virtual_machine|
212
216
  table << [
213
217
  virtual_machine['name'],
@@ -218,6 +222,7 @@ class VirtualMachine < CloudstackCli::Base
218
222
  virtual_machine['nic'].map { |nic| nic['ipaddress']}.join(' ')
219
223
  ]
220
224
  table.last.insert(1, virtual_machine['instancename']) if with_i_name
225
+ table.last.insert(-1, virtual_machine['hostname']) if with_h_name
221
226
  end
222
227
  print_table table
223
228
  say "Total number of virtual machines: #{virtual_machines.count}"
@@ -179,5 +179,17 @@ module CloudstackCli
179
179
  options
180
180
  end
181
181
 
182
+ def resolve_host(type = "routing")
183
+ if options[:host]
184
+ args = { name: options[:host], type: type, listall: true }
185
+ unless host = client.list_hosts(args).first
186
+ say "Error: Host '#{options[:host]}' not found.", :red
187
+ exit 1
188
+ end
189
+ options[:host_id] = host['id']
190
+ end
191
+ options
192
+ end
193
+
182
194
  end
183
195
  end
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-25 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc