cloudstack-cli 0.3.5 → 0.3.6
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 +7 -0
- data/Gemfile.lock +1 -1
- data/lib/cloudstack-cli/commands/network.rb +1 -1
- data/lib/cloudstack-cli/commands/router.rb +26 -3
- data/lib/cloudstack-cli/commands/server.rb +21 -0
- data/lib/cloudstack-cli/version.rb +1 -1
- data/lib/cloudstack-client/commands/router.rb +2 -1
- data/lib/cloudstack-client/version.rb +1 -1
- metadata +9 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 458ba90540b0b908c9a3a7a17e872398430d499d
|
4
|
+
data.tar.gz: 4c4ecde3c9ec1258ba99a7ac977448a547730312
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 369788758e78349fe10e0f44909a9c9746f8f4f0ea4a34a3f3e2d5df8bb78b9fa5deae056c0d36345286a721b72b56f3c62d0183dac5092ab0dc166cf220724c
|
7
|
+
data.tar.gz: 171a58cdafca0ee8a63dd1e77a3a4743eb61a0b7a579d7fd5f64669852d62386c30880178a94107770bb7c5d85c494725bba6fcb0f3248dd084cf0ad763efcd2
|
data/Gemfile.lock
CHANGED
@@ -29,7 +29,7 @@ class Network < CloudstackCli::Base
|
|
29
29
|
project = find_project if options[:project]
|
30
30
|
networks = []
|
31
31
|
if project
|
32
|
-
networks = client.list_networks(project['id'])
|
32
|
+
networks = client.list_networks(project_id: project['id'])
|
33
33
|
elsif options[:account]
|
34
34
|
networks = client.list_networks(account: options[:account])
|
35
35
|
else
|
@@ -5,7 +5,7 @@ class Router < CloudstackCli::Base
|
|
5
5
|
option :account
|
6
6
|
option :zone
|
7
7
|
option :status, desc: "Running or Stopped"
|
8
|
-
option :redundant_state, desc: "master, backup,
|
8
|
+
option :redundant_state, desc: "master, backup, fault or unknown"
|
9
9
|
option :listall, type: :boolean
|
10
10
|
option :showid, type: :boolean
|
11
11
|
option :command, desc: "command to execute for each router: START or STOP"
|
@@ -90,6 +90,27 @@ class Router < CloudstackCli::Base
|
|
90
90
|
watch_jobs(jobs)
|
91
91
|
end
|
92
92
|
|
93
|
+
desc "start NAME [NAME2 ..]", "restart virtual router(s) (stop and start)"
|
94
|
+
option :force, description: "restart without asking", type: :boolean, aliases: '-f'
|
95
|
+
def restart(*names)
|
96
|
+
routers = names.map {|name| get_router(name)}
|
97
|
+
print_routers(routers)
|
98
|
+
exit unless options[:force] || yes?("\nRestart router(s) above?", :magenta)
|
99
|
+
jobs = routers.map do |router|
|
100
|
+
{id: client.stop_router(router['id'], async: false)['jobid'], name: "Stop router #{router['name']}"}
|
101
|
+
end
|
102
|
+
puts
|
103
|
+
watch_jobs(jobs)
|
104
|
+
|
105
|
+
jobs = routers.map do |router|
|
106
|
+
{id: client.start_router(router['id'], async: false)['jobid'], name: "Start router #{router['name']}"}
|
107
|
+
end
|
108
|
+
puts
|
109
|
+
watch_jobs(jobs)
|
110
|
+
|
111
|
+
say "Finished.", :green
|
112
|
+
end
|
113
|
+
|
93
114
|
desc "destroy NAME [NAME2 ..]", "destroy virtual router(s)"
|
94
115
|
option :force, description: "destroy without asking", type: :boolean, aliases: '-f'
|
95
116
|
def destroy(*names)
|
@@ -107,8 +128,10 @@ class Router < CloudstackCli::Base
|
|
107
128
|
|
108
129
|
def get_router(name)
|
109
130
|
unless router = client.get_router(name)
|
110
|
-
|
111
|
-
|
131
|
+
unless router = client.get_router(name, -1)
|
132
|
+
say "Can't find router with name #{name}.", :red
|
133
|
+
exit 1
|
134
|
+
end
|
112
135
|
end
|
113
136
|
router
|
114
137
|
end
|
@@ -31,6 +31,27 @@ class Server < CloudstackCli::Base
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
desc "info NAME", "show detailed infos about a server"
|
35
|
+
option :project
|
36
|
+
def info(name)
|
37
|
+
if options[:project]
|
38
|
+
if options[:project].downcase == "all"
|
39
|
+
options[:project_id] = -1
|
40
|
+
else
|
41
|
+
project = find_project
|
42
|
+
options[:project_id] = project['id']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
unless server = client.get_server(name, options[:project_id])
|
46
|
+
puts "No server found."
|
47
|
+
else
|
48
|
+
server.each do |key, value|
|
49
|
+
say "#{key}: ", :yellow
|
50
|
+
say "#{value}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
34
55
|
desc "create NAME [NAME2 ...]", "create server(s)"
|
35
56
|
option :template, aliases: '-t', desc: "name of the template"
|
36
57
|
option :iso, desc: "name of the iso", desc: "name of the iso template"
|
@@ -5,12 +5,13 @@ module CloudstackClient
|
|
5
5
|
##
|
6
6
|
# Get a router with a given name.
|
7
7
|
|
8
|
-
def get_router(name)
|
8
|
+
def get_router(name, project_id = nil)
|
9
9
|
params = {
|
10
10
|
'command' => 'listRouters',
|
11
11
|
'listall' => 'true',
|
12
12
|
'name' => name
|
13
13
|
}
|
14
|
+
params['projectid'] = project_id if project_id
|
14
15
|
|
15
16
|
json = send_request(params)
|
16
17
|
json['router'] ? json['router'].first : nil
|
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nik Wolfgramm
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-09-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rdoc
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: thor
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -132,6 +125,7 @@ files:
|
|
132
125
|
homepage: https://bitbucket.org/swisstxt/cloudstack-cli
|
133
126
|
licenses:
|
134
127
|
- MIT
|
128
|
+
metadata: {}
|
135
129
|
post_install_message:
|
136
130
|
rdoc_options:
|
137
131
|
- --line-numbers
|
@@ -139,22 +133,20 @@ rdoc_options:
|
|
139
133
|
require_paths:
|
140
134
|
- lib
|
141
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
136
|
requirements:
|
144
|
-
- -
|
137
|
+
- - '>='
|
145
138
|
- !ruby/object:Gem::Version
|
146
139
|
version: 1.9.3
|
147
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
141
|
requirements:
|
150
|
-
- -
|
142
|
+
- - '>='
|
151
143
|
- !ruby/object:Gem::Version
|
152
144
|
version: '0'
|
153
145
|
requirements: []
|
154
146
|
rubyforge_project:
|
155
|
-
rubygems_version:
|
147
|
+
rubygems_version: 2.0.2
|
156
148
|
signing_key:
|
157
|
-
specification_version:
|
149
|
+
specification_version: 4
|
158
150
|
summary: cloudstack-cli CloudStack API client
|
159
151
|
test_files:
|
160
152
|
- test/stack_example.json
|