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
@@ -0,0 +1,45 @@
|
|
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
|
+
module Upgrade
|
21
|
+
#
|
22
|
+
# Implementation for the upgrade crowbar command
|
23
|
+
#
|
24
|
+
class Crowbar < Base
|
25
|
+
def request
|
26
|
+
@request ||= Request::Upgrade::Crowbar.new(
|
27
|
+
args
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute
|
32
|
+
request.process do |request|
|
33
|
+
case request.code
|
34
|
+
when 200
|
35
|
+
say "Triggered Crowbar operating system upgrade"
|
36
|
+
else
|
37
|
+
err request.parsed_response["error"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
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 node command
|
23
|
+
#
|
24
|
+
class Node < Base
|
25
|
+
def request
|
26
|
+
@request ||= Request::Upgrade::Node.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 triggered node upgrade on #{args.id}"
|
36
|
+
else
|
37
|
+
err request.parsed_response["error"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,61 @@
|
|
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 status command
|
23
|
+
#
|
24
|
+
class Prechecks < Base
|
25
|
+
include Mixin::Format
|
26
|
+
include Mixin::Filter
|
27
|
+
|
28
|
+
def request
|
29
|
+
@request ||= Request::Upgrade::Prechecks.new(
|
30
|
+
args
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute
|
35
|
+
request.process do |request|
|
36
|
+
case request.code
|
37
|
+
when 200
|
38
|
+
formatter = Formatter::Nested.new(
|
39
|
+
format: provide_format,
|
40
|
+
headings: ["Check", "Successful"],
|
41
|
+
values: Filter::Subset.new(
|
42
|
+
filter: provide_filter,
|
43
|
+
values: request.parsed_response
|
44
|
+
).result
|
45
|
+
)
|
46
|
+
|
47
|
+
if formatter.empty?
|
48
|
+
err "No checks"
|
49
|
+
else
|
50
|
+
say formatter.result
|
51
|
+
end
|
52
|
+
else
|
53
|
+
err request.parsed_response["error"]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,45 @@
|
|
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
|
+
module Upgrade
|
21
|
+
#
|
22
|
+
# Implementation for the upgrade prepare command
|
23
|
+
#
|
24
|
+
class Prepare < Base
|
25
|
+
def request
|
26
|
+
@request ||= Request::Upgrade::Prepare.new(
|
27
|
+
args
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute
|
32
|
+
request.process do |request|
|
33
|
+
case request.code
|
34
|
+
when 200
|
35
|
+
say "Setting nodes to upgrade state"
|
36
|
+
else
|
37
|
+
err request.parsed_response["error"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,61 @@
|
|
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 repocheck command
|
23
|
+
#
|
24
|
+
class Repocheck < Base
|
25
|
+
include Mixin::Format
|
26
|
+
include Mixin::Filter
|
27
|
+
|
28
|
+
def request
|
29
|
+
@request ||= Request::Upgrade::Repocheck.new(
|
30
|
+
args
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute
|
35
|
+
request.process do |request|
|
36
|
+
case request.code
|
37
|
+
when 200
|
38
|
+
formatter = Formatter::Nested.new(
|
39
|
+
format: provide_format,
|
40
|
+
headings: ["Status", "Value"],
|
41
|
+
values: Filter::Subset.new(
|
42
|
+
filter: provide_filter,
|
43
|
+
values: request.parsed_response
|
44
|
+
).result
|
45
|
+
)
|
46
|
+
|
47
|
+
if formatter.empty?
|
48
|
+
err "No repochecks"
|
49
|
+
else
|
50
|
+
say formatter.result
|
51
|
+
end
|
52
|
+
else
|
53
|
+
err request.parsed_response["error"]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,45 @@
|
|
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
|
+
module Upgrade
|
21
|
+
#
|
22
|
+
# Implementation for the upgrade services command
|
23
|
+
#
|
24
|
+
class Services < Base
|
25
|
+
def request
|
26
|
+
@request ||= Request::Upgrade::Services.new(
|
27
|
+
args
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute
|
32
|
+
request.process do |request|
|
33
|
+
case request.code
|
34
|
+
when 200
|
35
|
+
say "Stopping related services on all nodes"
|
36
|
+
else
|
37
|
+
err request.parsed_response["error"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,61 @@
|
|
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 status command
|
23
|
+
#
|
24
|
+
class Status < Base
|
25
|
+
include Mixin::Format
|
26
|
+
include Mixin::Filter
|
27
|
+
|
28
|
+
def request
|
29
|
+
@request ||= Request::Upgrade::Status.new(
|
30
|
+
args
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute
|
35
|
+
request.process do |request|
|
36
|
+
case request.code
|
37
|
+
when 200
|
38
|
+
formatter = Formatter::Nested.new(
|
39
|
+
format: provide_format,
|
40
|
+
headings: ["Status", "Value"],
|
41
|
+
values: Filter::Subset.new(
|
42
|
+
filter: provide_filter,
|
43
|
+
values: request.parsed_response
|
44
|
+
).result
|
45
|
+
)
|
46
|
+
|
47
|
+
if formatter.empty?
|
48
|
+
err "No status"
|
49
|
+
else
|
50
|
+
say formatter.result
|
51
|
+
end
|
52
|
+
else
|
53
|
+
err request.parsed_response["error"]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
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 Request
|
20
|
+
#
|
21
|
+
# Module for the upgrade request 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
|