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,83 @@
|
|
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
|
+
module Upgrade
|
21
|
+
#
|
22
|
+
# Implementation for the upgrade backup request
|
23
|
+
#
|
24
|
+
class Backup < Base
|
25
|
+
#
|
26
|
+
# Override the request headers
|
27
|
+
#
|
28
|
+
# @return [Hash] the headers for the request
|
29
|
+
#
|
30
|
+
def headers
|
31
|
+
super.easy_merge!(
|
32
|
+
::Crowbar::Client::Util::ApiVersion.new(2.0).headers
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Override the request content
|
38
|
+
#
|
39
|
+
# @return [Hash] the content for the request
|
40
|
+
#
|
41
|
+
def content
|
42
|
+
super.easy_merge!(
|
43
|
+
backup: {
|
44
|
+
name: "crowbar_upgrade_#{Time.now.to_i}"
|
45
|
+
}
|
46
|
+
) if attrs.component == "crowbar"
|
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
|
+
:post
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Path to the API endpoint for the request
|
60
|
+
#
|
61
|
+
# @return [String] path to the API endpoint
|
62
|
+
#
|
63
|
+
def url
|
64
|
+
case attrs.component
|
65
|
+
when "crowbar"
|
66
|
+
[
|
67
|
+
"api",
|
68
|
+
"crowbar",
|
69
|
+
"backups"
|
70
|
+
].join("/")
|
71
|
+
when "openstack"
|
72
|
+
[
|
73
|
+
"api",
|
74
|
+
"openstack",
|
75
|
+
"backup"
|
76
|
+
].join("/")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade crowbar request
|
25
|
+
#
|
26
|
+
class Crowbar < 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
|
+
# HTTP method that gets used by the request
|
40
|
+
#
|
41
|
+
# @return [Symbol] the method for the request
|
42
|
+
#
|
43
|
+
def method
|
44
|
+
:post
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Path to the API endpoint for the request
|
49
|
+
#
|
50
|
+
# @return [String] path to the API endpoint
|
51
|
+
#
|
52
|
+
def url
|
53
|
+
[
|
54
|
+
"api",
|
55
|
+
"crowbar",
|
56
|
+
"upgrade"
|
57
|
+
].join("/")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,75 @@
|
|
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
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade node request
|
25
|
+
#
|
26
|
+
class Node < 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
|
+
node: attrs.node
|
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
|
+
:post
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Path to the API endpoint for the request
|
60
|
+
#
|
61
|
+
# @return [String] path to the API endpoint
|
62
|
+
#
|
63
|
+
def url
|
64
|
+
[
|
65
|
+
"api",
|
66
|
+
"nodes",
|
67
|
+
attrs.node,
|
68
|
+
"upgrade"
|
69
|
+
].join("/")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade prechecks request
|
25
|
+
#
|
26
|
+
class Prechecks < 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
|
+
# HTTP method that gets used by the request
|
40
|
+
#
|
41
|
+
# @return [Symbol] the method for the request
|
42
|
+
#
|
43
|
+
def method
|
44
|
+
:get
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Path to the API endpoint for the request
|
49
|
+
#
|
50
|
+
# @return [String] path to the API endpoint
|
51
|
+
#
|
52
|
+
def url
|
53
|
+
[
|
54
|
+
"api",
|
55
|
+
"upgrade",
|
56
|
+
"prechecks"
|
57
|
+
].join("/")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade prepare request
|
25
|
+
#
|
26
|
+
class Prepare < 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
|
+
# HTTP method that gets used by the request
|
40
|
+
#
|
41
|
+
# @return [Symbol] the method for the request
|
42
|
+
#
|
43
|
+
def method
|
44
|
+
:post
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Path to the API endpoint for the request
|
49
|
+
#
|
50
|
+
# @return [String] path to the API endpoint
|
51
|
+
#
|
52
|
+
def url
|
53
|
+
[
|
54
|
+
"api",
|
55
|
+
"upgrade",
|
56
|
+
"prepare"
|
57
|
+
].join("/")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,72 @@
|
|
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
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade repocheck request
|
25
|
+
#
|
26
|
+
class Repocheck < 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
|
+
# HTTP method that gets used by the request
|
40
|
+
#
|
41
|
+
# @return [Symbol] the method for the request
|
42
|
+
#
|
43
|
+
def method
|
44
|
+
:get
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Path to the API endpoint for the request
|
49
|
+
#
|
50
|
+
# @return [String] path to the API endpoint
|
51
|
+
#
|
52
|
+
def url
|
53
|
+
case attrs.addon
|
54
|
+
when "storage"
|
55
|
+
[
|
56
|
+
"api",
|
57
|
+
"storages",
|
58
|
+
"repocheck"
|
59
|
+
].join("/")
|
60
|
+
when "ha"
|
61
|
+
[
|
62
|
+
"api",
|
63
|
+
"clusters",
|
64
|
+
"repocheck"
|
65
|
+
].join("/")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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
|
+
require "easy_diff"
|
18
|
+
|
19
|
+
module Crowbar
|
20
|
+
module Client
|
21
|
+
module Request
|
22
|
+
module Upgrade
|
23
|
+
#
|
24
|
+
# Implementation for the upgrade services request
|
25
|
+
#
|
26
|
+
class Services < 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
|
+
# HTTP method that gets used by the request
|
40
|
+
#
|
41
|
+
# @return [Symbol] the method for the request
|
42
|
+
#
|
43
|
+
def method
|
44
|
+
:post
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Path to the API endpoint for the request
|
49
|
+
#
|
50
|
+
# @return [String] path to the API endpoint
|
51
|
+
#
|
52
|
+
def url
|
53
|
+
[
|
54
|
+
"api",
|
55
|
+
"upgrade",
|
56
|
+
"services"
|
57
|
+
].join("/")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|