cloudstack-cli 0.5.5 → 0.5.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: 5dfcca0f542e684213495618ed1c34536fd1490e
4
- data.tar.gz: 9af0ffdc6f40c4894f27fccb44d71e097949664a
3
+ metadata.gz: 1b80bad1dfc75be88c1e41485ba830238d3e6905
4
+ data.tar.gz: 75a02bf7304b5a57b2eea1a1cf7d994ace7a8b62
5
5
  SHA512:
6
- metadata.gz: 3aba197e1259357da8ca08a17129e401ceedb00afa8b6aefea6b801c795fffc659aee9ce6dc39ddecb2f4edc5a93f7af58ef44309b865a6ef0dbe57e7a64a294
7
- data.tar.gz: 299ac9cc95acba6dc197ca1bb0215f2930f3aff8671fef1d60b48e8ab6b0fb79a5613ae0dac7a77a8dde9ab9bfe02f14aefcbd495b0e6d6276f0af3f6b73af97
6
+ metadata.gz: f3f1b99c24a31e4fb4cf689ebd336c61df93ffe1766a059df7f81ca0411f0d47e2f40d9fdad32155469c97f264bea9fe8e61199043667c80ffbcf8060cf42ba0
7
+ data.tar.gz: 8ddceb29263913e464bb9f6b0b55b8a452a3fb9a072ff7cedcb21aa54e088779273a5f13cbfe19a97c319318be18a8000b257b35ddf4a0fe5e05d17cfcd73099
data/Gemfile.lock CHANGED
@@ -1,6 +1,6 @@
1
1
  GIT
2
2
  remote: git@github.com:niwo/cloudstack_client.git
3
- revision: 7b28996ead63220d04b36766651d734e28383f90
3
+ revision: daf96086199cd1b9056eb1385fe4e2453cf6cd01
4
4
  branch: master
5
5
  specs:
6
6
  cloudstack_client (0.3.6)
@@ -8,8 +8,8 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- cloudstack-cli (0.5.4)
12
- cloudstack_client (>= 0.3.5)
11
+ cloudstack-cli (0.5.8)
12
+ cloudstack_client (~> 0.3, >= 0.3.6)
13
13
  thor (~> 0.18)
14
14
 
15
15
  GEM
@@ -52,17 +52,20 @@ module CloudstackCli
52
52
  config
53
53
  end
54
54
 
55
- def find_project(project_name = options[:project])
56
- return nil unless project_name
57
- unless project = client.get_project(project_name)
58
- say "Project '#{options[:project]}' not found", :red
55
+ def find_project(name = options[:project], allow_all = true)
56
+ return nil unless name
57
+ if allow_all && %w(ALL -1).include?(name)
58
+ return {'id' => '-1'}
59
+ end
60
+ unless project = client.get_project(name)
61
+ say "Project '#{name}' not found", :red
59
62
  exit 1
60
63
  end
61
64
  project
62
65
  end
63
66
 
64
- def filter_by(objects, tag_name, tag)
65
- objects.select {|r| r[tag_name].downcase == tag.downcase}
67
+ def filter_by(objects, key, value)
68
+ objects.select {|r| r[key].downcase == value.downcase}
66
69
  end
67
70
  end
68
71
  end
@@ -35,7 +35,8 @@ module CloudstackCli
35
35
  arg = arg.split('=')
36
36
  params[arg[0]] = arg[1]
37
37
  end
38
- puts JSON.pretty_generate(client.send_request params)
38
+ data = client.send_request(params)
39
+ puts JSON.pretty_generate(data)
39
40
  end
40
41
 
41
42
  # require subcommands
@@ -6,6 +6,7 @@ class Network < CloudstackCli::Base
6
6
  option :zone, desc: 'typehe name of the zone the network belongs to'
7
7
  option :type, desc: 'the type of the network'
8
8
  option :showid, type: :boolean, desc: 'show the network id'
9
+ option :showvlan, type: :boolean, desc: 'show the VLAN'
9
10
  def list
10
11
  project = find_project if options[:project]
11
12
  if options[:zone]
@@ -35,6 +36,7 @@ class Network < CloudstackCli::Base
35
36
  else
36
37
  table = [["Name", "Displaytext", "Account/Project", "Zone", "Domain", "State", "Type"]]
37
38
  table[0] << "ID" if options[:showid]
39
+ table[0] << "VLAN" if options[:showvlan]
38
40
  networks.each do |network|
39
41
  table << [
40
42
  network["name"],
@@ -46,6 +48,7 @@ class Network < CloudstackCli::Base
46
48
  network["type"]
47
49
  ]
48
50
  table[-1] << network["id"] if options[:showid]
51
+ table[-1] << network["vlan"] if options[:showvlan]
49
52
  end
50
53
  print_table table
51
54
  end
@@ -11,13 +11,7 @@ class Router < CloudstackCli::Base
11
11
  option :command, desc: "command to execute for each router: START or STOP"
12
12
  option :reverse, type: :boolean, default: false, desc: "reverse listing of routers"
13
13
  def list
14
- if options[:project]
15
- if ['-1', 'all'].include? options[:project]
16
- projectid = '-1'
17
- else
18
- projectid = find_project['id']
19
- end
20
- end
14
+ projectid = find_project['id'] if options[:project]
21
15
  routers = client.list_routers(
22
16
  {
23
17
  account: options[:account],
@@ -9,14 +9,8 @@ class Server < CloudstackCli::Base
9
9
  option :listall
10
10
  def list
11
11
  if options[:project]
12
- if %w(all -1).include? options[:project].downcase
13
- options[:project_id] = -1
14
- project_id = -1
15
- else
16
- project = find_project
17
- options[:project_id] = project['id']
18
- project_id = project['id']
19
- end
12
+ project_id = find_project['id']
13
+ options[:project_id] = project_id
20
14
  end
21
15
  servers = client.list_servers(options)
22
16
  if servers.size < 1
@@ -67,14 +61,7 @@ class Server < CloudstackCli::Base
67
61
  desc "show NAME", "show detailed infos about a server"
68
62
  option :project
69
63
  def show(name)
70
- if options[:project]
71
- if options[:project].downcase == "all"
72
- options[:project_id] = -1
73
- else
74
- project = find_project
75
- options[:project_id] = project['id']
76
- end
77
- end
64
+ options[:project_id] = find_project['id']
78
65
  unless server = client.get_server(name, options)
79
66
  puts "No server found."
80
67
  else
@@ -7,10 +7,7 @@ class Volume < CloudstackCli::Base
7
7
  option :name, desc: 'name of the disk volume'
8
8
  option :type, desc: 'type of disk volume (ROOT or DATADISK)'
9
9
  def list
10
- if options[:project]
11
- projectid = find_project['id']
12
- options[:project_id] = projectid if projectid
13
- end
10
+ options[:project_id] = find_project['id'] if options[:project]
14
11
  volumes = client.list_volumes(options)
15
12
  if volumes.size < 1
16
13
  say "No volumes found."
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.8"
3
3
  end
metadata CHANGED
@@ -1,75 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.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: 2014-01-14 00:00:00.000000000 Z
11
+ date: 2014-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.1'
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
26
  version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.18'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.18'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cloudstack_client
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.3'
62
- - - ">="
62
+ - - '>='
63
63
  - !ruby/object:Gem::Version
64
64
  version: 0.3.6
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - "~>"
69
+ - - ~>
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0.3'
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: 0.3.6
75
75
  description: cloudstack-cli is a CloudStack API client written in Ruby.
@@ -80,7 +80,7 @@ executables:
80
80
  extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
- - ".gitignore"
83
+ - .gitignore
84
84
  - Gemfile
85
85
  - Gemfile.lock
86
86
  - LICENSE.txt
@@ -125,23 +125,23 @@ licenses:
125
125
  metadata: {}
126
126
  post_install_message:
127
127
  rdoc_options:
128
- - "--line-numbers"
129
- - "--inline-source"
128
+ - --line-numbers
129
+ - --inline-source
130
130
  require_paths:
131
131
  - lib
132
132
  required_ruby_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - ">="
134
+ - - '>='
135
135
  - !ruby/object:Gem::Version
136
136
  version: 1.9.3
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - ">="
139
+ - - '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.2.0
144
+ rubygems_version: 2.0.3
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: cloudstack-cli CloudStack API client