crowbar-client 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/crowbar/client/app/upgrade.rb +21 -0
- data/lib/crowbar/client/command/backup/upload.rb +3 -0
- data/lib/crowbar/client/command/node/reset.rb +1 -1
- data/lib/crowbar/client/command/upgrade.rb +3 -0
- data/lib/crowbar/client/command/upgrade/mode.rb +58 -0
- data/lib/crowbar/client/request/backup/upload.rb +1 -4
- data/lib/crowbar/client/request/upgrade.rb +3 -0
- data/lib/crowbar/client/request/upgrade/mode.rb +78 -0
- data/lib/crowbar/client/version.rb +1 -1
- data/spec/crowbar/client/command/backup/upload_spec.rb +29 -0
- data/spec/crowbar/client/command/upgrade/mode_spec.rb +31 -0
- data/spec/crowbar/client/request/backup/upload_spec.rb +3 -6
- data/spec/crowbar/client/request/upgrade/mode_spec.rb +54 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e9ee78b325f208de3dfb08e444318cd016607aa
|
4
|
+
data.tar.gz: 9aa5c6c228225c4b824ce10c68f3f7794a0ba0e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c38b0e4b6b814a194220d455968398d9956252d798883f7108aed6c4824f91a571420351904879825a771c94bf2f68fd96e03956f9d00f9b254ef6e5d493b7c0
|
7
|
+
data.tar.gz: 401cd2d10f4289e316acb67200dd610dc2ce47f56ff7f76678b24653f60250859cccd2915c7061a3ae49710e1cf0581705fc307fded3f9caaacdf44bff48f968
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.2.2](https://github.com/crowbar/crowbar-client/releases/tag/v3.2.2) - 2017-03-08
|
4
|
+
|
5
|
+
* ENHANCEMENT
|
6
|
+
* Add support for api/upgrade/mode API
|
7
|
+
* BUGFIX
|
8
|
+
* Send a reset command on node reset (bsc#1025206)
|
9
|
+
* Check for file existance before uploading backup (bsc#1025309)
|
10
|
+
* Fix backup upload args (bsc#1026111)
|
11
|
+
|
3
12
|
## [3.2.1](https://github.com/crowbar/crowbar-client/releases/tag/v3.2.1) - 2017-02-14
|
4
13
|
|
5
14
|
* BUGFIX
|
@@ -367,6 +367,27 @@ module Crowbar
|
|
367
367
|
catch_errors(e)
|
368
368
|
end
|
369
369
|
|
370
|
+
desc "mode UPGRADEMODE",
|
371
|
+
"Set/Get the upgrade mode (normal|non_disruptive)"
|
372
|
+
|
373
|
+
long_desc <<-LONGDESC
|
374
|
+
`mode` allows you to switch the upgrade mode between `non_disruptive` and `normal`.
|
375
|
+
Calling it without any arguments will return the currently selected upgrade mode.
|
376
|
+
|
377
|
+
Note: Changing the upgrade mode is only possible before starting the `services`
|
378
|
+
step.
|
379
|
+
LONGDESC
|
380
|
+
|
381
|
+
def mode(mode = nil)
|
382
|
+
Command::Upgrade::Mode.new(
|
383
|
+
*command_params(
|
384
|
+
mode: mode
|
385
|
+
)
|
386
|
+
).execute
|
387
|
+
rescue => e
|
388
|
+
catch_errors(e)
|
389
|
+
end
|
390
|
+
|
370
391
|
desc "cancel",
|
371
392
|
"Cancel Crowbar upgrade"
|
372
393
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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 nodes command
|
23
|
+
#
|
24
|
+
class Mode < Base
|
25
|
+
include Mixin::UpgradeError
|
26
|
+
|
27
|
+
def request
|
28
|
+
@request ||= Request::Upgrade::Mode.new(
|
29
|
+
args
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def execute
|
34
|
+
unless ["normal", "non_disruptive", nil].include? args.mode
|
35
|
+
err "Invalid upgrade mode '#{args.mode}'. " \
|
36
|
+
"Only 'normal' and 'non_disruptive' are valid upgrade modes"
|
37
|
+
end
|
38
|
+
|
39
|
+
method = request.method
|
40
|
+
request.process do |request|
|
41
|
+
case request.code
|
42
|
+
when 200
|
43
|
+
if method == :post
|
44
|
+
say "Successfully switched to the \"#{args.mode}\" upgrade mode. "
|
45
|
+
else
|
46
|
+
mode = request.parsed_response["mode"] || "none"
|
47
|
+
say "Selected upgrade mode: '#{mode}'"
|
48
|
+
end
|
49
|
+
else
|
50
|
+
err request.parsed_response["error"]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade mode request
|
25
|
+
#
|
26
|
+
class Mode < Base
|
27
|
+
#
|
28
|
+
# Override the request headers
|
29
|
+
#
|
30
|
+
# @return [Hash] the headers for the request
|
31
|
+
#
|
32
|
+
def headers
|
33
|
+
super.easy_merge!(
|
34
|
+
::Crowbar::Client::Util::ApiVersion.new(2.0).headers
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Override the request content
|
40
|
+
#
|
41
|
+
# @return [Hash] the content for the request
|
42
|
+
#
|
43
|
+
def content
|
44
|
+
super.easy_merge!(
|
45
|
+
mode: attrs.mode
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# HTTP method that gets used by the request
|
51
|
+
#
|
52
|
+
# @return [Symbol] the method for the request
|
53
|
+
#
|
54
|
+
def method
|
55
|
+
if attrs.mode
|
56
|
+
:post
|
57
|
+
else
|
58
|
+
:get
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Path to the API endpoint for the request
|
64
|
+
#
|
65
|
+
# @return [String] path to the API endpoint
|
66
|
+
#
|
67
|
+
def url
|
68
|
+
[
|
69
|
+
"api",
|
70
|
+
"upgrade",
|
71
|
+
"mode"
|
72
|
+
].join("/")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -32,4 +32,33 @@ describe "Crowbar::Client::Command::Backup::Upload" do
|
|
32
32
|
)
|
33
33
|
end
|
34
34
|
end
|
35
|
+
context "Using a nonexistant file" do
|
36
|
+
it "should show an error message" do
|
37
|
+
expect do
|
38
|
+
Crowbar::Client::Command::Backup::Upload.new(
|
39
|
+
stdin,
|
40
|
+
stdout,
|
41
|
+
stderr,
|
42
|
+
{},
|
43
|
+
file: "test"
|
44
|
+
).request
|
45
|
+
end.to raise_error(Crowbar::Client::SimpleCatchableError, "File test does not exist.")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "Using a existing file" do
|
50
|
+
it "should NOT show an error message" do
|
51
|
+
expect do
|
52
|
+
Crowbar::Client::Command::Backup::Upload.new(
|
53
|
+
stdin,
|
54
|
+
stdout,
|
55
|
+
stderr,
|
56
|
+
{},
|
57
|
+
file: fixture_path(
|
58
|
+
"upload.tgz"
|
59
|
+
)
|
60
|
+
).request
|
61
|
+
end.not_to raise_error
|
62
|
+
end
|
63
|
+
end
|
35
64
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
require_relative "../../../../spec_helper"
|
18
|
+
|
19
|
+
describe "Crowbar::Client::Command::Upgrade::Mode" do
|
20
|
+
include_context "command_context"
|
21
|
+
|
22
|
+
it_behaves_like "a command class", true do
|
23
|
+
subject do
|
24
|
+
::Crowbar::Client::Command::Upgrade::Mode.new(
|
25
|
+
stdin,
|
26
|
+
stdout,
|
27
|
+
stderr
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -39,12 +39,9 @@ describe "Crowbar::Client::Request::Backup::Upload" do
|
|
39
39
|
let!(:params) do
|
40
40
|
{
|
41
41
|
backup: {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
"upload.tgz"
|
46
|
-
).open.path
|
47
|
-
}
|
42
|
+
file: fixture_path(
|
43
|
+
"upload.tgz"
|
44
|
+
).open.path
|
48
45
|
}
|
49
46
|
}
|
50
47
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, 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
|
+
require_relative "../../../../spec_helper"
|
18
|
+
|
19
|
+
describe "Crowbar::Client::Request::Upgrade::Mode" do
|
20
|
+
it_behaves_like "a request class", true do
|
21
|
+
subject do
|
22
|
+
::Crowbar::Client::Request::Upgrade::Mode.new(
|
23
|
+
attrs
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
let!(:attrs) do
|
28
|
+
{
|
29
|
+
mode: "normal"
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
let!(:params) do
|
34
|
+
{
|
35
|
+
mode: "normal"
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
let!(:method) do
|
40
|
+
:post
|
41
|
+
end
|
42
|
+
|
43
|
+
let!(:url) do
|
44
|
+
"api/upgrade/mode"
|
45
|
+
end
|
46
|
+
|
47
|
+
let!(:headers) do
|
48
|
+
{
|
49
|
+
"Content-Type" => "application/vnd.crowbar.v2.0+json",
|
50
|
+
"Accept" => "application/vnd.crowbar.v2.0+json"
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowbar-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Boerger
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-03-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -320,6 +320,7 @@ files:
|
|
320
320
|
- lib/crowbar/client/command/upgrade/backup.rb
|
321
321
|
- lib/crowbar/client/command/upgrade/cancel.rb
|
322
322
|
- lib/crowbar/client/command/upgrade/database.rb
|
323
|
+
- lib/crowbar/client/command/upgrade/mode.rb
|
323
324
|
- lib/crowbar/client/command/upgrade/nodes.rb
|
324
325
|
- lib/crowbar/client/command/upgrade/prechecks.rb
|
325
326
|
- lib/crowbar/client/command/upgrade/prepare.rb
|
@@ -421,6 +422,7 @@ files:
|
|
421
422
|
- lib/crowbar/client/request/upgrade/backup.rb
|
422
423
|
- lib/crowbar/client/request/upgrade/cancel.rb
|
423
424
|
- lib/crowbar/client/request/upgrade/database.rb
|
425
|
+
- lib/crowbar/client/request/upgrade/mode.rb
|
424
426
|
- lib/crowbar/client/request/upgrade/nodes.rb
|
425
427
|
- lib/crowbar/client/request/upgrade/prechecks.rb
|
426
428
|
- lib/crowbar/client/request/upgrade/prepare.rb
|
@@ -492,6 +494,7 @@ files:
|
|
492
494
|
- spec/crowbar/client/command/upgrade/backup_spec.rb
|
493
495
|
- spec/crowbar/client/command/upgrade/cancel_spec.rb
|
494
496
|
- spec/crowbar/client/command/upgrade/database_spec.rb
|
497
|
+
- spec/crowbar/client/command/upgrade/mode_spec.rb
|
495
498
|
- spec/crowbar/client/command/upgrade/nodes_spec.rb
|
496
499
|
- spec/crowbar/client/command/upgrade/prechecks_spec.rb
|
497
500
|
- spec/crowbar/client/command/upgrade/prepare_spec.rb
|
@@ -555,6 +558,7 @@ files:
|
|
555
558
|
- spec/crowbar/client/request/upgrade/backup_spec.rb
|
556
559
|
- spec/crowbar/client/request/upgrade/cancel_spec.rb
|
557
560
|
- spec/crowbar/client/request/upgrade/database_spec.rb
|
561
|
+
- spec/crowbar/client/request/upgrade/mode_spec.rb
|
558
562
|
- spec/crowbar/client/request/upgrade/nodes_spec.rb
|
559
563
|
- spec/crowbar/client/request/upgrade/prechecks_spec.rb
|
560
564
|
- spec/crowbar/client/request/upgrade/prepare_spec.rb
|
@@ -655,6 +659,7 @@ test_files:
|
|
655
659
|
- spec/crowbar/client/command/upgrade/backup_spec.rb
|
656
660
|
- spec/crowbar/client/command/upgrade/cancel_spec.rb
|
657
661
|
- spec/crowbar/client/command/upgrade/database_spec.rb
|
662
|
+
- spec/crowbar/client/command/upgrade/mode_spec.rb
|
658
663
|
- spec/crowbar/client/command/upgrade/nodes_spec.rb
|
659
664
|
- spec/crowbar/client/command/upgrade/prechecks_spec.rb
|
660
665
|
- spec/crowbar/client/command/upgrade/prepare_spec.rb
|
@@ -718,6 +723,7 @@ test_files:
|
|
718
723
|
- spec/crowbar/client/request/upgrade/backup_spec.rb
|
719
724
|
- spec/crowbar/client/request/upgrade/cancel_spec.rb
|
720
725
|
- spec/crowbar/client/request/upgrade/database_spec.rb
|
726
|
+
- spec/crowbar/client/request/upgrade/mode_spec.rb
|
721
727
|
- spec/crowbar/client/request/upgrade/nodes_spec.rb
|
722
728
|
- spec/crowbar/client/request/upgrade/prechecks_spec.rb
|
723
729
|
- spec/crowbar/client/request/upgrade/prepare_spec.rb
|