cloudstack-cli 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cloudstack-cli/commands/virtual_machine.rb +5 -0
- data/lib/cloudstack-cli/option_resolver.rb +12 -0
- data/lib/cloudstack-cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 679d16d7fc4a542b3c7688838fb8060f8d080af0
|
4
|
+
data.tar.gz: 06e2eedaa8a3657c6c9c178bee2177b931d1961e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb62fe90ba957a0db37f4509bed59dd620f29c0afec8fe97b5d0ad94baffb15ce9c2f33e488914c8fad0e412731c734e34551641df9e77be20d667d8dc490e8d
|
7
|
+
data.tar.gz: bdab190dd7921c9a5e027edfb8a0eb93036f9eb32eb16385840113e316df82364ef5053ac7bf0d0b517fedd54341a88e35390a5ad24de41c0fb0cc11162dd934
|
data/Gemfile.lock
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|