crowbar-client 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +7 -0
- data/lib/crowbar/client/app.rb +3 -0
- data/lib/crowbar/client/app/entry.rb +4 -0
- data/lib/crowbar/client/app/upgrade.rb +280 -0
- data/lib/crowbar/client/command.rb +3 -0
- data/lib/crowbar/client/command/upgrade.rb +50 -0
- data/lib/crowbar/client/command/upgrade/backup.rb +45 -0
- data/lib/crowbar/client/command/upgrade/crowbar.rb +45 -0
- data/lib/crowbar/client/command/upgrade/node.rb +45 -0
- data/lib/crowbar/client/command/upgrade/prechecks.rb +61 -0
- data/lib/crowbar/client/command/upgrade/prepare.rb +45 -0
- data/lib/crowbar/client/command/upgrade/repocheck.rb +61 -0
- data/lib/crowbar/client/command/upgrade/services.rb +45 -0
- data/lib/crowbar/client/command/upgrade/status.rb +61 -0
- data/lib/crowbar/client/config.rb +2 -4
- data/lib/crowbar/client/request.rb +3 -0
- data/lib/crowbar/client/request/upgrade.rb +50 -0
- data/lib/crowbar/client/request/upgrade/backup.rb +83 -0
- data/lib/crowbar/client/request/upgrade/crowbar.rb +63 -0
- data/lib/crowbar/client/request/upgrade/node.rb +75 -0
- data/lib/crowbar/client/request/upgrade/prechecks.rb +63 -0
- data/lib/crowbar/client/request/upgrade/prepare.rb +63 -0
- data/lib/crowbar/client/request/upgrade/repocheck.rb +72 -0
- data/lib/crowbar/client/request/upgrade/services.rb +63 -0
- data/lib/crowbar/client/request/upgrade/status.rb +62 -0
- data/lib/crowbar/client/version.rb +2 -2
- data/spec/crowbar/client/command/upgrade/backup_spec.rb +34 -0
- data/spec/crowbar/client/command/upgrade/crowbar_spec.rb +31 -0
- data/spec/crowbar/client/command/upgrade/node_spec.rb +32 -0
- data/spec/crowbar/client/command/upgrade/prechecks_spec.rb +31 -0
- data/spec/crowbar/client/command/upgrade/prepare_spec.rb +31 -0
- data/spec/crowbar/client/command/upgrade/repocheck_spec.rb +34 -0
- data/spec/crowbar/client/command/upgrade/services_spec.rb +31 -0
- data/spec/crowbar/client/command/upgrade/status_spec.rb +31 -0
- data/spec/crowbar/client/request/backup/create_spec.rb +4 -0
- data/spec/crowbar/client/request/backup/delete_spec.rb +4 -0
- data/spec/crowbar/client/request/backup/download_spec.rb +4 -0
- data/spec/crowbar/client/request/backup/list_spec.rb +4 -0
- data/spec/crowbar/client/request/backup/restore_spec.rb +4 -0
- data/spec/crowbar/client/request/backup/upload_spec.rb +4 -0
- data/spec/crowbar/client/request/{party_spec.rb → rest_spec.rb} +3 -3
- data/spec/crowbar/client/request/upgrade/backup_spec.rb +53 -0
- data/spec/crowbar/client/request/upgrade/crowbar_spec.rb +53 -0
- data/spec/crowbar/client/request/upgrade/node_spec.rb +55 -0
- data/spec/crowbar/client/request/upgrade/prechecks_spec.rb +53 -0
- data/spec/crowbar/client/request/upgrade/prepare_spec.rb +53 -0
- data/spec/crowbar/client/request/upgrade/repocheck_spec.rb +56 -0
- data/spec/crowbar/client/request/upgrade/services_spec.rb +53 -0
- data/spec/crowbar/client/request/upgrade/status_spec.rb +53 -0
- metadata +55 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWFkZGRhY2FjZmZiODEyOGZlNzhhMWFiNGI2YzdmNzhmYjFmYjczMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGZmMjNkNzYxNzhjZjhhMzg3ZDYxZDZmNzQxNTAzMjE2NTJjZTUyZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmE2MTU3ZDkwZDFhZWZiMGEyOWM1ZjQwMzQ0OGYyZjU0ZWY4MzI5Y2JjNDZi
|
10
|
+
NzFkNmQ2YzJhNTNiZGE4YzFlMDY2NWIwODdjYjMyNDQ2YjU1NTZmMTRlOWY3
|
11
|
+
NWZmN2ZjNDViNTZjYTI0NzhiZWNhMGVmYTczYjI1NDQ3NWJhYjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTkwNzUzODcxY2EzZTExMzVjYWIwZDNhYWVkMjc5Zjg2NTE3OWIzNjI1OWYz
|
14
|
+
MmNiMGNiZjgwMWY1ZDNlM2JlNGNkNTFiZjAxODc0YzY3ZmY4YWNmNzQ1NTQz
|
15
|
+
NTEyZTFlNTcyMWI1YWJjY2E3YWE3ZTNkZTljMDc2ZGEyNGQwY2U=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.1.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.1.0) - 2016-08-23
|
4
|
+
|
5
|
+
* BUGFIX
|
6
|
+
* Set the default apiversion to 1.0 (@MaximilianMeister)
|
7
|
+
* ENHANCEMENT
|
8
|
+
* Add upgrade subcommand (@MaximilianMeister)
|
9
|
+
|
3
10
|
## [3.0.1](https://github.com/crowbar/crowbar-client/releases/tag/v3.0.1) - 2016-08-19
|
4
11
|
|
5
12
|
* BUGFIX
|
data/lib/crowbar/client/app.rb
CHANGED
@@ -148,6 +148,10 @@ module Crowbar
|
|
148
148
|
desc "installer [COMMANDS]",
|
149
149
|
"Installer specific commands, call without params for help"
|
150
150
|
subcommand "installer", Crowbar::Client::App::Installer
|
151
|
+
|
152
|
+
desc "upgrade [COMMANDS]",
|
153
|
+
"Upgrade specific commands, call without params for help"
|
154
|
+
subcommand "upgrade", Crowbar::Client::App::Upgrade
|
151
155
|
end
|
152
156
|
end
|
153
157
|
end
|
@@ -0,0 +1,280 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, SUSE Linux GmbH
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Crowbar
|
18
|
+
module Client
|
19
|
+
module App
|
20
|
+
#
|
21
|
+
# A Thor based CLI wrapper for upgrade commands
|
22
|
+
#
|
23
|
+
class Upgrade < Base
|
24
|
+
desc "status",
|
25
|
+
"Show the status of the upgrade"
|
26
|
+
|
27
|
+
long_desc <<-LONGDESC
|
28
|
+
`status` will print out a status of the upgrade.
|
29
|
+
You can display the status in different output formats
|
30
|
+
and you can filter the list by any search criteria.
|
31
|
+
|
32
|
+
With --format <format> option you can choose an output format
|
33
|
+
with the available options table, json or plain. You can also
|
34
|
+
use the shortcut options --table, --json or --plain.
|
35
|
+
|
36
|
+
With --filter <filter> option you can limit the result of
|
37
|
+
printed out elements. You can use any substring that is part
|
38
|
+
of the found elements.
|
39
|
+
LONGDESC
|
40
|
+
|
41
|
+
method_option :format,
|
42
|
+
type: :string,
|
43
|
+
default: "table",
|
44
|
+
banner: "<format>",
|
45
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
46
|
+
|
47
|
+
method_option :table,
|
48
|
+
type: :boolean,
|
49
|
+
default: false,
|
50
|
+
aliases: [],
|
51
|
+
desc: "Format output as table, a shortcut for --format table option"
|
52
|
+
|
53
|
+
method_option :json,
|
54
|
+
type: :boolean,
|
55
|
+
default: false,
|
56
|
+
aliases: [],
|
57
|
+
desc: "Format output as table, a shortcut for --format json option"
|
58
|
+
|
59
|
+
method_option :plain,
|
60
|
+
type: :boolean,
|
61
|
+
default: false,
|
62
|
+
aliases: [],
|
63
|
+
desc: "Format output as table, a shortcut for --format plain option"
|
64
|
+
|
65
|
+
method_option :filter,
|
66
|
+
type: :string,
|
67
|
+
default: nil,
|
68
|
+
banner: "<filter>",
|
69
|
+
desc: "Filter by criteria, display only data that contains filter"
|
70
|
+
|
71
|
+
def status
|
72
|
+
Command::Upgrade::Status.new(
|
73
|
+
*command_params
|
74
|
+
).execute
|
75
|
+
rescue => e
|
76
|
+
catch_errors(e)
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "prepare",
|
80
|
+
"Prepare Crowbar upgrade"
|
81
|
+
|
82
|
+
long_desc <<-LONGDESC
|
83
|
+
`prepare` will set the nodes to upgrading state
|
84
|
+
LONGDESC
|
85
|
+
|
86
|
+
def prepare
|
87
|
+
Command::Upgrade::Prepare.new(
|
88
|
+
*command_params
|
89
|
+
).execute
|
90
|
+
rescue => e
|
91
|
+
catch_errors(e)
|
92
|
+
end
|
93
|
+
|
94
|
+
desc "services",
|
95
|
+
"Stop related services on all nodes during upgrade"
|
96
|
+
|
97
|
+
long_desc <<-LONGDESC
|
98
|
+
`services` will stop all related services on all nodes
|
99
|
+
during the upgrade.
|
100
|
+
|
101
|
+
With --format <format> option you can choose an output format
|
102
|
+
with the available options table, json or plain. You can also
|
103
|
+
use the shortcut options --table, --json or --plain.
|
104
|
+
|
105
|
+
With --filter <filter> option you can limit the result of
|
106
|
+
printed out rows. You can use any substring that is part of
|
107
|
+
the found rows.
|
108
|
+
LONGDESC
|
109
|
+
|
110
|
+
def services
|
111
|
+
Command::Upgrade::Services.new(
|
112
|
+
*command_params
|
113
|
+
).execute
|
114
|
+
rescue => e
|
115
|
+
catch_errors(e)
|
116
|
+
end
|
117
|
+
|
118
|
+
desc "prechecks",
|
119
|
+
"Perform checks to make sure Crowbar can be upgraded"
|
120
|
+
|
121
|
+
long_desc <<-LONGDESC
|
122
|
+
`prechecks` will perform a sanity check on the Crowbar server to
|
123
|
+
make sure that the server, nodes and services can be upgraded.
|
124
|
+
|
125
|
+
With --format <format> option you can choose an output format
|
126
|
+
with the available options table, json or plain. You can also
|
127
|
+
use the shortcut options --table, --json or --plain.
|
128
|
+
|
129
|
+
With --filter <filter> option you can limit the result of
|
130
|
+
printed out rows. You can use any substring that is part of
|
131
|
+
the found rows.
|
132
|
+
LONGDESC
|
133
|
+
|
134
|
+
method_option :format,
|
135
|
+
type: :string,
|
136
|
+
default: "table",
|
137
|
+
banner: "<format>",
|
138
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
139
|
+
|
140
|
+
method_option :table,
|
141
|
+
type: :boolean,
|
142
|
+
default: false,
|
143
|
+
aliases: [],
|
144
|
+
desc: "Format output as table, a shortcut for --format table option"
|
145
|
+
|
146
|
+
method_option :json,
|
147
|
+
type: :boolean,
|
148
|
+
default: false,
|
149
|
+
aliases: [],
|
150
|
+
desc: "Format output as table, a shortcut for --format json option"
|
151
|
+
|
152
|
+
method_option :plain,
|
153
|
+
type: :boolean,
|
154
|
+
default: false,
|
155
|
+
aliases: [],
|
156
|
+
desc: "Format output as table, a shortcut for --format plain option"
|
157
|
+
|
158
|
+
method_option :filter,
|
159
|
+
type: :string,
|
160
|
+
default: nil,
|
161
|
+
banner: "<filter>",
|
162
|
+
desc: "Filter by criteria, display only data that contains filter"
|
163
|
+
|
164
|
+
def prechecks
|
165
|
+
Command::Upgrade::Prechecks.new(
|
166
|
+
*command_params
|
167
|
+
).execute
|
168
|
+
rescue => e
|
169
|
+
catch_errors(e)
|
170
|
+
end
|
171
|
+
|
172
|
+
desc "crowbar",
|
173
|
+
"Upgrade Crowbar"
|
174
|
+
|
175
|
+
long_desc <<-LONGDESC
|
176
|
+
`crowbar` will upgrade the operating system of the Crowbar server.
|
177
|
+
LONGDESC
|
178
|
+
|
179
|
+
def crowbar
|
180
|
+
Command::Upgrade::Crowbar.new(
|
181
|
+
*command_params
|
182
|
+
).execute
|
183
|
+
rescue => e
|
184
|
+
catch_errors(e)
|
185
|
+
end
|
186
|
+
|
187
|
+
desc "node NODE",
|
188
|
+
"Upgrade a single node"
|
189
|
+
|
190
|
+
long_desc <<-LONGDESC
|
191
|
+
`node NODE` will upgrade the operating system of a single node.
|
192
|
+
LONGDESC
|
193
|
+
|
194
|
+
def node(node)
|
195
|
+
Command::Upgrade::Node.new(
|
196
|
+
*command_params(
|
197
|
+
node: node
|
198
|
+
)
|
199
|
+
).execute
|
200
|
+
rescue => e
|
201
|
+
catch_errors(e)
|
202
|
+
end
|
203
|
+
|
204
|
+
desc "backup COMPONENT",
|
205
|
+
"Create a backup of a component (crowbar|openstack)"
|
206
|
+
|
207
|
+
long_desc <<-LONGDESC
|
208
|
+
`backup COMPONENT` will create a backup of Crowbar or the
|
209
|
+
OpenStack database. COMPONENT can be 'crowbar' or 'openstack'
|
210
|
+
LONGDESC
|
211
|
+
|
212
|
+
def backup(component)
|
213
|
+
Command::Upgrade::Backup.new(
|
214
|
+
*command_params(
|
215
|
+
component: component
|
216
|
+
)
|
217
|
+
).execute
|
218
|
+
rescue => e
|
219
|
+
catch_errors(e)
|
220
|
+
end
|
221
|
+
|
222
|
+
desc "repocheck ADDON",
|
223
|
+
"Check for existing repositories for an addon (ha|storage)"
|
224
|
+
|
225
|
+
long_desc <<-LONGDESC
|
226
|
+
`repocheck ADDON` will check for existing repositories
|
227
|
+
for a specifix addon product. ADDON can be 'storage' or 'ha'
|
228
|
+
|
229
|
+
With --format <format> option you can choose an output format
|
230
|
+
with the available options table, json or plain. You can also
|
231
|
+
use the shortcut options --table, --json or --plain.
|
232
|
+
|
233
|
+
With --filter <filter> option you can limit the result of
|
234
|
+
printed out rows. You can use any substring that is part of
|
235
|
+
the found rows.
|
236
|
+
LONGDESC
|
237
|
+
|
238
|
+
method_option :format,
|
239
|
+
type: :string,
|
240
|
+
default: "table",
|
241
|
+
banner: "<format>",
|
242
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
243
|
+
|
244
|
+
method_option :table,
|
245
|
+
type: :boolean,
|
246
|
+
default: false,
|
247
|
+
aliases: [],
|
248
|
+
desc: "Format output as table, a shortcut for --format table option"
|
249
|
+
|
250
|
+
method_option :json,
|
251
|
+
type: :boolean,
|
252
|
+
default: false,
|
253
|
+
aliases: [],
|
254
|
+
desc: "Format output as table, a shortcut for --format json option"
|
255
|
+
|
256
|
+
method_option :plain,
|
257
|
+
type: :boolean,
|
258
|
+
default: false,
|
259
|
+
aliases: [],
|
260
|
+
desc: "Format output as table, a shortcut for --format plain option"
|
261
|
+
|
262
|
+
method_option :filter,
|
263
|
+
type: :string,
|
264
|
+
default: nil,
|
265
|
+
banner: "<filter>",
|
266
|
+
desc: "Filter by criteria, display only data that contains filter"
|
267
|
+
|
268
|
+
def repocheck(addon)
|
269
|
+
Command::Upgrade::Repocheck.new(
|
270
|
+
*command_params(
|
271
|
+
addon: addon
|
272
|
+
)
|
273
|
+
).execute
|
274
|
+
rescue => e
|
275
|
+
catch_errors(e)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016, SUSE Linux GmbH
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Crowbar
|
18
|
+
module Client
|
19
|
+
module Command
|
20
|
+
#
|
21
|
+
# Module for the upgrade command implementations
|
22
|
+
#
|
23
|
+
module Upgrade
|
24
|
+
autoload :Backup,
|
25
|
+
File.expand_path("../upgrade/backup", __FILE__)
|
26
|
+
|
27
|
+
autoload :Crowbar,
|
28
|
+
File.expand_path("../upgrade/crowbar", __FILE__)
|
29
|
+
|
30
|
+
autoload :Node,
|
31
|
+
File.expand_path("../upgrade/node", __FILE__)
|
32
|
+
|
33
|
+
autoload :Prechecks,
|
34
|
+
File.expand_path("../upgrade/prechecks", __FILE__)
|
35
|
+
|
36
|
+
autoload :Prepare,
|
37
|
+
File.expand_path("../upgrade/prepare", __FILE__)
|
38
|
+
|
39
|
+
autoload :Repocheck,
|
40
|
+
File.expand_path("../upgrade/repocheck", __FILE__)
|
41
|
+
|
42
|
+
autoload :Services,
|
43
|
+
File.expand_path("../upgrade/services", __FILE__)
|
44
|
+
|
45
|
+
autoload :Status,
|
46
|
+
File.expand_path("../upgrade/status", __FILE__)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, SUSE Linux GmbH
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Crowbar
|
18
|
+
module Client
|
19
|
+
module Command
|
20
|
+
module Upgrade
|
21
|
+
#
|
22
|
+
# Implementation for the upgrade backup command
|
23
|
+
#
|
24
|
+
class Backup < Base
|
25
|
+
def request
|
26
|
+
@request ||= Request::Upgrade::Backup.new(
|
27
|
+
args
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute
|
32
|
+
request.process do |request|
|
33
|
+
case request.code
|
34
|
+
when 200
|
35
|
+
say "Successfully created backup for #{args.component}"
|
36
|
+
else
|
37
|
+
err request.parsed_response["error"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|