cloudstack-cli 0.14.0 → 0.14.1

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: 463f0fd4f677877f7369ad4de5fc7047dd854125
4
- data.tar.gz: 32acd6310d8448cbb8e70df4bac657b290e9e17c
3
+ metadata.gz: 4992b15860eda6fbefe75457c67366290a0b7301
4
+ data.tar.gz: bb3848d8d6b67d3cddadb12391d70783f2077846
5
5
  SHA512:
6
- metadata.gz: 688f24864400caaab25304529d080f2d52454d1dd1626f7f0fce6468bb6357e826b1d7ef12a76c8aa499c12cf9025289e735069906a28a4c198e65ef5aed4ea8
7
- data.tar.gz: f37bb9bebce58335f78c3ea050719703ba1e96655ac7e9d4cb752d8b5dca403aacb5f6eb887031ae0b3d3f14c9041ff031946a36016f2945b6377a0344a31510
6
+ metadata.gz: 51f6c75a86c111e6e26665d534d2ccffb4122e3bae46d956084ef61392389f99dbab757c7dfc048b5bcda9c4eb9e0eabd9f6374e2fb672dd99f4080bcdeeffe6
7
+ data.tar.gz: 96bee024c0ba4af985cb9508bf8525dfabfd0092667630a5bc70f2cb3117c9b4010d01a1974b384a2b5aea5f6fcd9da4241249ea3648ad0787f1fe9e5cc07d49
@@ -1,15 +1,15 @@
1
1
  GIT
2
2
  remote: git@github.com:niwo/cloudstack_client.git
3
- revision: 56f489ce1649c6d2f6809382787de2ee48968655
3
+ revision: f4aa35073e82129aa27600cef0987254d2453259
4
4
  branch: master
5
5
  specs:
6
- cloudstack_client (0.9.3)
6
+ cloudstack_client (0.9.7)
7
7
 
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- cloudstack-cli (0.14.0)
12
- cloudstack_client (~> 0.9.3)
11
+ cloudstack-cli (0.14.1)
12
+ cloudstack_client (~> 0.9.7)
13
13
  thor (~> 0.19.1)
14
14
 
15
15
  GEM
@@ -25,5 +25,5 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency('rake', '~> 10.4')
26
26
 
27
27
  gem.add_dependency('thor', '~> 0.19.1')
28
- gem.add_dependency('cloudstack_client', '~> 0.9.3')
28
+ gem.add_dependency('cloudstack_client', '~> 0.9.7')
29
29
  end
@@ -20,6 +20,7 @@ module CloudstackCli
20
20
  desc "version", "Print cloudstack-cli version number"
21
21
  def version
22
22
  say "cloudstack-cli version #{CloudstackCli::VERSION}"
23
+ say " (cloudstack_client version #{CloudstackClient::VERSION})"
23
24
  end
24
25
  map %w(-v --version) => :version
25
26
 
@@ -27,4 +27,29 @@ class Project < CloudstackCli::Base
27
27
  end
28
28
  end
29
29
 
30
+ desc "list_accounts PROJECT_NAME", "show accounts belonging to a project"
31
+ def list_accounts(name)
32
+ unless project = client.get_project(name)
33
+ say "No project with name #{name} found."
34
+ else
35
+ accounts = client.list_project_accounts(project['id'], options)
36
+ if accounts.size < 1
37
+ say "No project accounts found."
38
+ else
39
+ table = [%w(Name Type Domain State)]
40
+ accounts.each do |account|
41
+ table << [
42
+ account['name'],
43
+ TYPES[account['accounttype']],
44
+ account['domain'],
45
+ account['state']
46
+ ]
47
+ end
48
+ print_table table
49
+ say "Total number of project accounts: #{accounts.size}"
50
+ print_table table
51
+ end
52
+ end
53
+ end
54
+
30
55
  end
@@ -40,7 +40,6 @@ class Server < CloudstackCli::Base
40
40
  say "Total number of servers: #{servers.count}"
41
41
 
42
42
  if options[:command]
43
- args = { project_id: project_id, sync: true, account: options[:account] }
44
43
  command = options[:command].downcase
45
44
  unless %w(start stop reboot).include?(command)
46
45
  say "\nCommand #{options[:command]} not supported.", :red
@@ -49,7 +48,12 @@ class Server < CloudstackCli::Base
49
48
  exit unless yes?("\n#{command.capitalize} the server(s) above? [y/N]:", :magenta)
50
49
  servers.each_slice(options[:concurrency]) do | batch |
51
50
  jobs = batch.map do |server|
52
- {id: client.send("#{command}_server", server['name'], args)['jobid'], name: "#{command.capitalize} server #{server['name']}"}
51
+ args = { sync: true, account: server['account'] }
52
+ args[:project_id] = server['projectid'] if server['projectid']
53
+ {
54
+ id: client.send("#{command}_server", server['name'], args)['jobid'],
55
+ name: "#{command.capitalize} server #{server['name']}"
56
+ }
53
57
  end
54
58
  puts
55
59
  watch_jobs(jobs)
@@ -173,16 +177,16 @@ class Server < CloudstackCli::Base
173
177
  option :account
174
178
  def start(name)
175
179
  options[:project_id] = find_project['id'] if options[:project]
176
- say("Start server #{name}", :magenta)
180
+ say("Starting server #{name}", :magenta)
177
181
  client.start_server(name, options)
178
182
  puts
179
183
  end
180
184
 
181
- desc "restart NAME", "restart a server"
185
+ desc "reboot NAME", "reboot a server"
182
186
  option :project
183
187
  option :account
184
188
  option :force
185
- def restart(name)
189
+ def reboot(name)
186
190
  options[:project_id] = find_project['id'] if options[:project]
187
191
  exit unless options[:force] || yes?("Reboot server #{name}? [y/N]:", :magenta)
188
192
  client.reboot_server(name, options)
@@ -3,10 +3,12 @@ class SystemVm < CloudstackCli::Base
3
3
  desc 'list', 'list system VMs'
4
4
  option :zone, desc: "the name of the availability zone"
5
5
  option :state, desc: "state of the system VM"
6
+ option :type, desc: "the system VM type.",
7
+ enum: %w(consoleproxy secondarystoragevm)
6
8
  def list
7
9
  vms = client.list_system_vms(options)
8
10
  if vms.size < 1
9
- say "No system vms found."
11
+ say "No system VM's found."
10
12
  else
11
13
  table = [["Zone", "State", "Type", "Name"]]
12
14
  vms.each do |vm|
@@ -15,17 +17,14 @@ class SystemVm < CloudstackCli::Base
15
17
  ]
16
18
  end
17
19
  print_table table
18
- say "Total number of system vms: #{vms.size}"
20
+ say "Total number of system VM's: #{vms.size}"
19
21
  end
20
22
  end
21
23
 
22
- desc 'show [name]', 'show system vm'
23
- option :zone
24
+ desc 'show NAME', 'show system VM'
24
25
  def show(name)
25
- vms = client.list_system_vms(options)
26
- vms = filter_by(vms, 'name', name)
27
- vm = vms.first
28
- unless vm
26
+ vms = client.list_system_vms
27
+ unless vm = filter_by(vms, 'name', name).first
29
28
  say "No system vm with name #{name} found."
30
29
  else
31
30
  table = vm.map do |key, value|
@@ -35,4 +34,40 @@ class SystemVm < CloudstackCli::Base
35
34
  end
36
35
  end
37
36
 
37
+ desc "start NAME", "start a system VM"
38
+ def start(name)
39
+ vms = client.list_system_vms
40
+ unless vm = filter_by(vms, 'name', name).first
41
+ say "No system vm with name #{name} found."
42
+ else
43
+ say("Starting system VM #{name}", :magenta)
44
+ client.start_system_vm(vm['id'])
45
+ puts
46
+ end
47
+ end
48
+
49
+ desc "stop NAME", "stop a system VM"
50
+ def stop(name)
51
+ vms = client.list_system_vms(options)
52
+ unless vm = filter_by(vms, 'name', name).first
53
+ say "No system vm with name #{name} found."
54
+ else
55
+ exit unless options[:force] || yes?("Stop system VM #{name}? [y/N]:", :magenta)
56
+ client.stop_system_vm(vm['id'])
57
+ puts
58
+ end
59
+ end
60
+
61
+ desc "reboot NAME", "reboot a system VM"
62
+ def reboot(name)
63
+ vms = client.list_system_vms(options)
64
+ unless vm = filter_by(vms, 'name', name).first
65
+ say "No system vm with name #{name} found."
66
+ else
67
+ exit unless options[:force] || yes?("Reboot system VM #{name}? [y/N]:", :magenta)
68
+ client.reboot_system_vm(vm['id'])
69
+ puts
70
+ end
71
+ end
72
+
38
73
  end
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "0.14.0"
2
+ VERSION = "0.14.1"
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: 0.14.0
4
+ version: 0.14.1
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-03-09 00:00:00.000000000 Z
11
+ date: 2015-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.3
61
+ version: 0.9.7
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.9.3
68
+ version: 0.9.7
69
69
  description: cloudstack-cli is a CloudStack API command line client written in Ruby.
70
70
  email:
71
71
  - nik.wolfgramm@gmail.com