crowbar-client 2.1.0 → 2.2.0
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/crowbar/client.rb +6 -0
- data/lib/crowbar/client/app.rb +3 -0
- data/lib/crowbar/client/app/barclamp.rb +2 -2
- data/lib/crowbar/client/app/base.rb +24 -1
- data/lib/crowbar/client/app/batch.rb +4 -4
- data/lib/crowbar/client/app/entry.rb +4 -0
- data/lib/crowbar/client/app/host_ip.rb +4 -4
- data/lib/crowbar/client/app/installer.rb +103 -0
- data/lib/crowbar/client/app/interface.rb +4 -4
- data/lib/crowbar/client/app/node.rb +34 -34
- data/lib/crowbar/client/app/proposal.rb +14 -14
- data/lib/crowbar/client/app/repository.rb +10 -10
- data/lib/crowbar/client/app/reset.rb +4 -4
- data/lib/crowbar/client/app/role.rb +4 -4
- data/lib/crowbar/client/app/server.rb +2 -2
- data/lib/crowbar/client/app/virtual_ip.rb +4 -4
- data/lib/crowbar/client/command.rb +3 -0
- data/lib/crowbar/client/command/installer.rb +29 -0
- data/lib/crowbar/client/command/installer/start.rb +50 -0
- data/lib/crowbar/client/command/installer/status.rb +68 -0
- data/lib/crowbar/client/command/proposal/create.rb +19 -5
- data/lib/crowbar/client/command/proposal/edit.rb +19 -5
- data/lib/crowbar/client/request.rb +3 -0
- data/lib/crowbar/client/request/base.rb +12 -0
- data/lib/crowbar/client/request/installer.rb +29 -0
- data/lib/crowbar/client/request/installer/start.rb +44 -0
- data/lib/crowbar/client/request/installer/status.rb +36 -0
- data/lib/crowbar/client/version.rb +1 -1
- data/spec/crowbar/client/command/installer/start_spec.rb +40 -0
- data/spec/crowbar/client/command/installer/status_spec.rb +39 -0
- data/spec/crowbar/client/request/installer/start_spec.rb +55 -0
- data/spec/crowbar/client/request/installer/status_spec.rb +65 -0
- data/spec/support/request_examples.rb +4 -0
- metadata +84 -69
@@ -72,8 +72,8 @@ module Crowbar
|
|
72
72
|
barclamp: barclamp
|
73
73
|
)
|
74
74
|
).execute
|
75
|
-
rescue
|
76
|
-
|
75
|
+
rescue => e
|
76
|
+
catch_errors(e)
|
77
77
|
end
|
78
78
|
|
79
79
|
desc "show BARCLAMP PROPOSAL",
|
@@ -134,8 +134,8 @@ module Crowbar
|
|
134
134
|
proposal: proposal
|
135
135
|
)
|
136
136
|
).execute
|
137
|
-
rescue
|
138
|
-
|
137
|
+
rescue => e
|
138
|
+
catch_errors(e)
|
139
139
|
end
|
140
140
|
|
141
141
|
desc "create BARCLAMP PROPOSAL",
|
@@ -184,8 +184,8 @@ module Crowbar
|
|
184
184
|
proposal: proposal
|
185
185
|
)
|
186
186
|
).execute
|
187
|
-
rescue
|
188
|
-
|
187
|
+
rescue => e
|
188
|
+
catch_errors(e)
|
189
189
|
end
|
190
190
|
|
191
191
|
desc "edit BARCLAMP PROPOSAL",
|
@@ -234,8 +234,8 @@ module Crowbar
|
|
234
234
|
proposal: proposal
|
235
235
|
)
|
236
236
|
).execute
|
237
|
-
rescue
|
238
|
-
|
237
|
+
rescue => e
|
238
|
+
catch_errors(e)
|
239
239
|
end
|
240
240
|
|
241
241
|
desc "delete BARCLAMP PROPOSAL",
|
@@ -253,8 +253,8 @@ module Crowbar
|
|
253
253
|
proposal: proposal
|
254
254
|
)
|
255
255
|
).execute
|
256
|
-
rescue
|
257
|
-
|
256
|
+
rescue => e
|
257
|
+
catch_errors(e)
|
258
258
|
end
|
259
259
|
|
260
260
|
desc "dequeue BARCLAMP PROPOSAL",
|
@@ -272,8 +272,8 @@ module Crowbar
|
|
272
272
|
proposal: proposal
|
273
273
|
)
|
274
274
|
).execute
|
275
|
-
rescue
|
276
|
-
|
275
|
+
rescue => e
|
276
|
+
catch_errors(e)
|
277
277
|
end
|
278
278
|
|
279
279
|
desc "commit BARCLAMP PROPOSAL",
|
@@ -291,8 +291,8 @@ module Crowbar
|
|
291
291
|
proposal: proposal
|
292
292
|
)
|
293
293
|
).execute
|
294
|
-
rescue
|
295
|
-
|
294
|
+
rescue => e
|
295
|
+
catch_errors(e)
|
296
296
|
end
|
297
297
|
end
|
298
298
|
end
|
@@ -70,8 +70,8 @@ module Crowbar
|
|
70
70
|
Command::Repository::List.new(
|
71
71
|
*command_params
|
72
72
|
).execute
|
73
|
-
rescue
|
74
|
-
|
73
|
+
rescue => e
|
74
|
+
catch_errors(e)
|
75
75
|
end
|
76
76
|
|
77
77
|
desc "activate PLATFORM REPO",
|
@@ -89,8 +89,8 @@ module Crowbar
|
|
89
89
|
repo: repo
|
90
90
|
)
|
91
91
|
).execute
|
92
|
-
rescue
|
93
|
-
|
92
|
+
rescue => e
|
93
|
+
catch_errors(e)
|
94
94
|
end
|
95
95
|
|
96
96
|
desc "activate-all",
|
@@ -105,8 +105,8 @@ module Crowbar
|
|
105
105
|
Command::Repository::ActivateAll.new(
|
106
106
|
*command_params
|
107
107
|
).execute
|
108
|
-
rescue
|
109
|
-
|
108
|
+
rescue => e
|
109
|
+
catch_errors(e)
|
110
110
|
end
|
111
111
|
|
112
112
|
desc "deactivate PLATFORM REPO",
|
@@ -124,8 +124,8 @@ module Crowbar
|
|
124
124
|
repo: repo
|
125
125
|
)
|
126
126
|
).execute
|
127
|
-
rescue
|
128
|
-
|
127
|
+
rescue => e
|
128
|
+
catch_errors(e)
|
129
129
|
end
|
130
130
|
|
131
131
|
desc "deactivate-all",
|
@@ -140,8 +140,8 @@ module Crowbar
|
|
140
140
|
Command::Repository::DeactivateAll.new(
|
141
141
|
*command_params
|
142
142
|
).execute
|
143
|
-
rescue
|
144
|
-
|
143
|
+
rescue => e
|
144
|
+
catch_errors(e)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
@@ -33,8 +33,8 @@ module Crowbar
|
|
33
33
|
proposal: proposal
|
34
34
|
)
|
35
35
|
).execute
|
36
|
-
rescue
|
37
|
-
|
36
|
+
rescue => e
|
37
|
+
catch_errors(e)
|
38
38
|
end
|
39
39
|
|
40
40
|
desc "nodes",
|
@@ -49,8 +49,8 @@ module Crowbar
|
|
49
49
|
Command::Reset::Nodes.new(
|
50
50
|
*command_params
|
51
51
|
).execute
|
52
|
-
rescue
|
53
|
-
|
52
|
+
rescue => e
|
53
|
+
catch_errors(e)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -72,8 +72,8 @@ module Crowbar
|
|
72
72
|
barclamp: barclamp
|
73
73
|
)
|
74
74
|
).execute
|
75
|
-
rescue
|
76
|
-
|
75
|
+
rescue => e
|
76
|
+
catch_errors(e)
|
77
77
|
end
|
78
78
|
|
79
79
|
desc "show BARCLAMP ROLE",
|
@@ -131,8 +131,8 @@ module Crowbar
|
|
131
131
|
role: role
|
132
132
|
)
|
133
133
|
).execute
|
134
|
-
rescue
|
135
|
-
|
134
|
+
rescue => e
|
135
|
+
catch_errors(e)
|
136
136
|
end
|
137
137
|
end
|
138
138
|
end
|
@@ -36,8 +36,8 @@ module Crowbar
|
|
36
36
|
suggestion: suggestion
|
37
37
|
)
|
38
38
|
).execute
|
39
|
-
rescue
|
40
|
-
|
39
|
+
rescue => e
|
40
|
+
catch_errors(e)
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "deallocate PROPOSAL SERVICE NETWORK",
|
@@ -56,8 +56,8 @@ module Crowbar
|
|
56
56
|
network: network
|
57
57
|
)
|
58
58
|
).execute
|
59
|
-
rescue
|
60
|
-
|
59
|
+
rescue => e
|
60
|
+
catch_errors(e)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -0,0 +1,29 @@
|
|
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 Installer
|
21
|
+
autoload :Status,
|
22
|
+
File.expand_path("../installer/status", __FILE__)
|
23
|
+
|
24
|
+
autoload :Start,
|
25
|
+
File.expand_path("../installer/start", __FILE__)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,50 @@
|
|
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 Installer
|
21
|
+
class Start < Base
|
22
|
+
def request
|
23
|
+
@request ||= Request::Installer::Start.new(
|
24
|
+
args.easy_merge(
|
25
|
+
force: options.force
|
26
|
+
)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def execute
|
31
|
+
request.process do |request|
|
32
|
+
case request.code
|
33
|
+
when 200
|
34
|
+
say "Triggered installation process"
|
35
|
+
when 226
|
36
|
+
say "Crowbar already installing"
|
37
|
+
when 410
|
38
|
+
say "Installation is already done"
|
39
|
+
when 501
|
40
|
+
err "Platform is not supported"
|
41
|
+
else
|
42
|
+
err request.parsed_response["error"]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,68 @@
|
|
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 Installer
|
21
|
+
class Status < Base
|
22
|
+
include Mixin::Format
|
23
|
+
include Mixin::Filter
|
24
|
+
|
25
|
+
def request
|
26
|
+
@request ||= Request::Installer::Status.new(
|
27
|
+
args
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute
|
32
|
+
request.process do |request|
|
33
|
+
case request.code
|
34
|
+
when 200
|
35
|
+
formatter = Formatter::Nested.new(
|
36
|
+
format: provide_format,
|
37
|
+
headings: ["Status", "Value"],
|
38
|
+
values: Filter::Subset.new(
|
39
|
+
filter: provide_filter,
|
40
|
+
values: content_from(request)
|
41
|
+
).result
|
42
|
+
)
|
43
|
+
|
44
|
+
if formatter.empty?
|
45
|
+
err "No status"
|
46
|
+
else
|
47
|
+
say formatter.result
|
48
|
+
end
|
49
|
+
else
|
50
|
+
err request.parsed_response["error"]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
protected
|
56
|
+
|
57
|
+
def content_from(request)
|
58
|
+
request.parsed_response.except(
|
59
|
+
"errorMsg",
|
60
|
+
"noticeMsg",
|
61
|
+
"successMsg"
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -66,9 +66,11 @@ module Crowbar
|
|
66
66
|
|
67
67
|
def from_data
|
68
68
|
json = begin
|
69
|
-
JSON.load
|
70
|
-
|
71
|
-
|
69
|
+
JSON.load(
|
70
|
+
options[:data]
|
71
|
+
)
|
72
|
+
rescue JSON::ParserError
|
73
|
+
err "Failed to parse JSON"
|
72
74
|
end
|
73
75
|
|
74
76
|
if options[:merge]
|
@@ -82,9 +84,21 @@ module Crowbar
|
|
82
84
|
|
83
85
|
def from_file
|
84
86
|
json = begin
|
85
|
-
|
87
|
+
file = File.read(
|
88
|
+
options[:file]
|
89
|
+
)
|
90
|
+
|
91
|
+
JSON.load(
|
92
|
+
file
|
93
|
+
)
|
94
|
+
rescue Errno::EACCES
|
95
|
+
err "Failed to access file"
|
96
|
+
rescue Errno::ENOENT
|
97
|
+
err "Failed to read file"
|
98
|
+
rescue JSON::ParserError
|
99
|
+
err "Failed to parse JSON"
|
86
100
|
rescue
|
87
|
-
err "
|
101
|
+
err "Failed to process file"
|
88
102
|
end
|
89
103
|
|
90
104
|
if options[:merge]
|
@@ -65,9 +65,11 @@ module Crowbar
|
|
65
65
|
|
66
66
|
def from_data
|
67
67
|
json = begin
|
68
|
-
JSON.load
|
69
|
-
|
70
|
-
|
68
|
+
JSON.load(
|
69
|
+
options[:data]
|
70
|
+
)
|
71
|
+
rescue JSON::ParserError
|
72
|
+
err "Failed to parse JSON"
|
71
73
|
end
|
72
74
|
|
73
75
|
if options[:merge]
|
@@ -81,9 +83,21 @@ module Crowbar
|
|
81
83
|
|
82
84
|
def from_file
|
83
85
|
json = begin
|
84
|
-
|
86
|
+
file = File.read(
|
87
|
+
options[:file]
|
88
|
+
)
|
89
|
+
|
90
|
+
JSON.load(
|
91
|
+
file
|
92
|
+
)
|
93
|
+
rescue Errno::EACCES
|
94
|
+
err "Failed to access file"
|
95
|
+
rescue Errno::ENOENT
|
96
|
+
err "Failed to read file"
|
97
|
+
rescue JSON::ParserError
|
98
|
+
err "Failed to parse JSON"
|
85
99
|
rescue
|
86
|
-
err "
|
100
|
+
err "Failed to process file"
|
87
101
|
end
|
88
102
|
|
89
103
|
if options[:merge]
|