cloudstack-cli 1.5.6 → 1.5.7

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: 5bf65435b9f87f2a26dad263cb17283cfbf11c49
4
- data.tar.gz: a52d6aa1d060649024e085feddc041031e714487
3
+ metadata.gz: d099b0bfa2e3e253687b229068afb8bd7db8c26c
4
+ data.tar.gz: 9834e72d1fc6f4fea8d3e6aa8483ecf05df6a592
5
5
  SHA512:
6
- metadata.gz: 578d5a63cbe75133dca255c114e3e65f79eead7038c3f1af3ad61331d8a43272f5407c7339f76789d7c768ad1a3b656310bc750d2cda1d663003db13b0b79d8b
7
- data.tar.gz: 5b8f5f98ae5bc7813fd5f9c31eb661cb9a928c52558ff261808cb244c70a18feb49126de20652f69d3a4fa22d68689bade1bd2c89935da3053cc94ad11658768
6
+ metadata.gz: 73dac4d635ea0c72e53f09a1d7a71f99591a188aa6c3f47327c737d0024defe095c913106cac6a85dd0b0df3826082a89bbccae061035b8104ee326e57665550
7
+ data.tar.gz: 665f5287031e7065eaf49372cbc9679cbb9da07e2a0a92a668bd7eddc3d85ac1462ad974222b7aab0b6e4d6afd09615d6db7a2cf27cb6a5272b7f86976498a8c
data/Gemfile.lock CHANGED
@@ -6,14 +6,14 @@ PATH
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- cloudstack-cli (1.5.6)
10
- cloudstack_client (~> 1.4)
9
+ cloudstack-cli (1.5.7)
10
+ cloudstack_client (~> 1.4.3)
11
11
  thor (~> 0.19)
12
12
 
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- rake (11.2.2)
16
+ rake (11.3.0)
17
17
  thor (0.19.1)
18
18
 
19
19
  PLATFORMS
@@ -22,7 +22,7 @@ PLATFORMS
22
22
  DEPENDENCIES
23
23
  cloudstack-cli!
24
24
  cloudstack_client!
25
- rake (~> 11.2)
25
+ rake (~> 11.3)
26
26
 
27
27
  BUNDLED WITH
28
- 1.12.5
28
+ 1.13.2
data/README.md CHANGED
@@ -162,7 +162,7 @@ Completed: 2/3 (15.4s)
162
162
  ### Example: Sort computing offerings
163
163
 
164
164
  *Sort all computing offerings by CPU and Memory grouped by domain:*
165
- (root admin privileges needed)
165
+ (root admin privileges required)
166
166
 
167
167
  ```bash
168
168
  $ cloudstack-cli compute_offer sort
@@ -21,8 +21,8 @@ Gem::Specification.new do |gem|
21
21
  gem.require_paths = %w(lib)
22
22
  gem.rdoc_options = %w[--line-numbers --inline-source]
23
23
 
24
- gem.add_development_dependency('rake', '~> 11.2')
24
+ gem.add_development_dependency('rake', '~> 11.3')
25
25
 
26
- gem.add_dependency('cloudstack_client', '~> 1.4')
26
+ gem.add_dependency('cloudstack_client', '~> 1.4.3')
27
27
  gem.add_dependency('thor', '~> 0.19')
28
28
  end
@@ -14,23 +14,28 @@ class Capacity < CloudstackCli::Base
14
14
 
15
15
  desc "list", "list system capacity"
16
16
  option :zone, desc: "list capacity by zone"
17
+ option :cluster, desc: "list capacity by cluster"
17
18
  option :type, desc: "specify type, see types for a list of types"
18
19
  def list
19
- resolve_zone if options[:zone]
20
+ resolve_zone
21
+ resolve_cluster
20
22
  capacities = client.list_capacity(options)
21
23
  table = []
22
24
  header = ["Zone", "Type", "Capacity Used", "Capacity Total", "Used"]
25
+ header[0] = "Cluster" if options[:cluster_id]
23
26
  capacities.each do |c|
24
- table << [
25
- c['zonename'],
26
- CAPACITY_TYPES[c['type']][:name],
27
- capacity_to_s(c, 'capacityused'),
28
- capacity_to_s(c, 'capacitytotal'),
29
- "#{c['percentused']}%"
30
- ]
27
+ if CAPACITY_TYPES.include? c['type']
28
+ table << [
29
+ c['clustername'] || c['zonename'],
30
+ CAPACITY_TYPES[c['type']][:name],
31
+ capacity_to_s(c, 'capacityused'),
32
+ capacity_to_s(c, 'capacitytotal'),
33
+ "#{c['percentused']}%"
34
+ ]
35
+ end
31
36
  end
32
- table = table.sort {|a, b| [a[0], a[1]] <=> [b[0], b[1]]}.insert(0, header)
33
- print_table table
37
+ table = table.sort {|a, b| [a[0], a[1]] <=> [b[0], b[1]]}
38
+ print_table table.insert(0, header)
34
39
  end
35
40
 
36
41
  desc "types", "show capacity types"
@@ -240,5 +240,16 @@ module CloudstackCli
240
240
  options
241
241
  end
242
242
 
243
+ def resolve_cluster
244
+ if options[:cluster]
245
+ unless cluster = client.list_clusters(name: options[:cluster]).first
246
+ say "Error: Cluster '#{options[:cluster]}' not found.", :red
247
+ exit 1
248
+ end
249
+ options[:cluster_id] = cluster['id']
250
+ end
251
+ options
252
+ end
253
+
243
254
  end
244
255
  end
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "1.5.6"
2
+ VERSION = "1.5.7"
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.5.6
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-05 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '11.2'
19
+ version: '11.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '11.2'
26
+ version: '11.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cloudstack_client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.4'
33
+ version: 1.4.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.4'
40
+ version: 1.4.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.4.5.1
136
+ rubygems_version: 2.5.1
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: cloudstack-cli CloudStack API client