crowbar-client 3.6.1 → 3.9.3
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 +33 -0
- data/lib/crowbar/client/app.rb +6 -0
- data/lib/crowbar/client/app/entry.rb +13 -0
- data/lib/crowbar/client/app/proposal.rb +20 -0
- data/lib/crowbar/client/app/restricted.rb +136 -0
- data/lib/crowbar/client/app/ses.rb +54 -0
- data/lib/crowbar/client/command.rb +6 -0
- data/lib/crowbar/client/command/base.rb +9 -0
- data/lib/crowbar/client/command/proposal/edit.rb +5 -1
- data/lib/crowbar/client/command/proposal/show.rb +7 -1
- data/lib/crowbar/client/command/restricted.rb +38 -0
- data/lib/crowbar/client/command/restricted/allocate.rb +51 -0
- data/lib/crowbar/client/command/restricted/ping.rb +45 -0
- data/lib/crowbar/client/command/restricted/show.rb +72 -0
- data/lib/crowbar/client/command/restricted/transition.rb +47 -0
- data/lib/crowbar/client/command/ses.rb +29 -0
- data/lib/crowbar/client/command/ses/upload.rb +60 -0
- data/lib/crowbar/client/command/upgrade/repocheck.rb +3 -1
- data/lib/crowbar/client/config.rb +24 -8
- data/lib/crowbar/client/request.rb +6 -0
- data/lib/crowbar/client/request/restricted.rb +38 -0
- data/lib/crowbar/client/request/restricted/allocate.rb +50 -0
- data/lib/crowbar/client/request/restricted/ping.rb +49 -0
- data/lib/crowbar/client/request/restricted/show.rb +50 -0
- data/lib/crowbar/client/request/restricted/transition.rb +63 -0
- data/lib/crowbar/client/request/ses.rb +29 -0
- data/lib/crowbar/client/request/ses/upload.rb +65 -0
- data/lib/crowbar/client/util.rb +3 -0
- data/lib/crowbar/client/util/apiversion.rb +2 -8
- data/lib/crowbar/client/util/osrelease.rb +37 -0
- data/lib/crowbar/client/version.rb +2 -2
- metadata +26 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e428d67fddb2605dc6e67286978de425bcdb5ebd45a932b31b1e13d570446a01
|
4
|
+
data.tar.gz: 31c88554931ea3a50ffb69dff36a65ae13f7b6791d9d5fd2c7f59ed213f437f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a09a55cde22dc377eafea92a9379c660443c6543376b37a81346ebfc472c2bc6bda346a205ee7526447fd75c58c14d8296735af757121899ac39c2b8207e9a3b
|
7
|
+
data.tar.gz: a1b8116be6e1c8d3653e6b4c284e861b2a4ff71c67a66243190a95b36de9c0c7863c15ee3692161d1c40df621bb575659e641fc212563b7caf69bb3485610ed5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.9.3](https://github.com/crowbar/crowbar-client/releases/tag/v3.9.2) - 2020-09-02
|
4
|
+
|
5
|
+
* ENHANCEMENT
|
6
|
+
* Enable restricted commands for Cloud 7 (bsc#1117080)
|
7
|
+
|
8
|
+
## [3.9.2](https://github.com/crowbar/crowbar-client/releases/tag/v3.9.2) - 2020-03-09
|
9
|
+
|
10
|
+
* ENHANCEMENT
|
11
|
+
* Enable SES commands in Cloud8 (SOC-11122)
|
12
|
+
|
13
|
+
## [3.9.1](https://github.com/crowbar/crowbar-client/releases/tag/v3.9.1) - 2019-07-01
|
14
|
+
|
15
|
+
* BUGFIX
|
16
|
+
* Fix repocheck table output (SOC-10718)
|
17
|
+
* Enable restricted commands for Cloud8 (bsc#1117080)
|
18
|
+
|
19
|
+
## [3.9.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.9.0) - 2019-04-05
|
20
|
+
|
21
|
+
* ENHANCEMENT
|
22
|
+
* Add support for the restricted APIs
|
23
|
+
* Add --raw to "proposal show" & "proposal edit"
|
24
|
+
* Correctly parse error messages that we don't handle natively
|
25
|
+
|
26
|
+
## [3.8.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.8.0) - 2019-04-02
|
27
|
+
|
28
|
+
* ENHANCEMENT
|
29
|
+
* Add 'ses' subcommand to upload SES configuration file to crowbar (@skazi0)
|
30
|
+
|
31
|
+
## [3.7.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.7.0) - 2018-12-14
|
32
|
+
|
33
|
+
* ENHANCEMENT
|
34
|
+
* Better upgrade repocheck output
|
35
|
+
|
3
36
|
## [3.6.1](https://github.com/crowbar/crowbar-client/releases/tag/v3.6.1) - 2018-12-07
|
4
37
|
|
5
38
|
* BUGFIX
|
data/lib/crowbar/client/app.rb
CHANGED
@@ -59,9 +59,15 @@ module Crowbar
|
|
59
59
|
autoload :Repository,
|
60
60
|
File.expand_path("../app/repository", __FILE__)
|
61
61
|
|
62
|
+
autoload :Restricted,
|
63
|
+
File.expand_path("../app/restricted", __FILE__)
|
64
|
+
|
62
65
|
autoload :Role,
|
63
66
|
File.expand_path("../app/role", __FILE__)
|
64
67
|
|
68
|
+
autoload :Ses,
|
69
|
+
File.expand_path("../app/ses", __FILE__)
|
70
|
+
|
65
71
|
autoload :Server,
|
66
72
|
File.expand_path("../app/server", __FILE__)
|
67
73
|
|
@@ -166,6 +166,19 @@ module Crowbar
|
|
166
166
|
desc "services [COMMANDS]",
|
167
167
|
"Services specific commands, call without params for help"
|
168
168
|
subcommand "services", Crowbar::Client::App::Services
|
169
|
+
|
170
|
+
desc "ses [COMMANDS]",
|
171
|
+
"SES (Ceph) specific commands, call without params for help"
|
172
|
+
subcommand "ses", Crowbar::Client::App::Ses
|
173
|
+
|
174
|
+
desc "restricted [COMMANDS]",
|
175
|
+
"Commands specifc to restricted clients, call without params for help"
|
176
|
+
subcommand "restricted", Crowbar::Client::App::Restricted
|
177
|
+
|
178
|
+
# hide SES command in older versions
|
179
|
+
remove_command :ses unless Config.defaults[:cloud_version].to_i >= 8
|
180
|
+
# hide Restricted command in older versions
|
181
|
+
remove_command :restricted unless Config.defaults[:cloud_version].to_i >= 7
|
169
182
|
end
|
170
183
|
end
|
171
184
|
end
|
@@ -98,6 +98,10 @@ module Crowbar
|
|
98
98
|
With --filter <filter> option you can limit the result of
|
99
99
|
printed out elements. You can use any substring that is part
|
100
100
|
of the found elements.
|
101
|
+
|
102
|
+
With --raw option you can ensure that the program will not
|
103
|
+
automatically alter the proposal (to remove non-existing
|
104
|
+
nodes, for instance).
|
101
105
|
LONGDESC
|
102
106
|
|
103
107
|
method_option :format,
|
@@ -130,6 +134,12 @@ module Crowbar
|
|
130
134
|
banner: "<filter>",
|
131
135
|
desc: "Filter by criteria, display only data that contains filter"
|
132
136
|
|
137
|
+
method_option :raw,
|
138
|
+
type: :boolean,
|
139
|
+
default: false,
|
140
|
+
aliases: ["-r"],
|
141
|
+
desc: "Do not automatically edit the content of the proposal data"
|
142
|
+
|
133
143
|
def show(barclamp, proposal)
|
134
144
|
Command::Proposal::Show.new(
|
135
145
|
*command_params(
|
@@ -221,6 +231,10 @@ module Crowbar
|
|
221
231
|
|
222
232
|
With --merge option you can deep merge the provided data with
|
223
233
|
the preloaded proposal.
|
234
|
+
|
235
|
+
With --raw option you can ensure that the program will not
|
236
|
+
automatically alter the proposal (to remove non-existing
|
237
|
+
nodes, for instance).
|
224
238
|
LONGDESC
|
225
239
|
|
226
240
|
method_option :data,
|
@@ -241,6 +255,12 @@ module Crowbar
|
|
241
255
|
aliases: ["-m"],
|
242
256
|
desc: "Merge input loaded from server with proposal data"
|
243
257
|
|
258
|
+
method_option :raw,
|
259
|
+
type: :boolean,
|
260
|
+
default: false,
|
261
|
+
aliases: ["-r"],
|
262
|
+
desc: "Do not automatically edit the content of the proposal data"
|
263
|
+
|
244
264
|
def edit(barclamp, proposal)
|
245
265
|
Command::Proposal::Edit.new(
|
246
266
|
*command_params(
|
@@ -0,0 +1,136 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2019, SUSE
|
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 restricted commands
|
22
|
+
#
|
23
|
+
class Restricted < Base
|
24
|
+
desc "allocate NAME_OR_ALIAS",
|
25
|
+
"Allocate the specified node"
|
26
|
+
|
27
|
+
long_desc <<-LONGDESC
|
28
|
+
`allocate NAME_OR_ALIAS` will try to allocate the specified
|
29
|
+
node.
|
30
|
+
LONGDESC
|
31
|
+
|
32
|
+
def allocate(name)
|
33
|
+
Command::Restricted::Allocate.new(
|
34
|
+
*command_params(
|
35
|
+
name: name
|
36
|
+
)
|
37
|
+
).execute
|
38
|
+
rescue => e
|
39
|
+
catch_errors(e)
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "ping",
|
43
|
+
"Ping the administration server"
|
44
|
+
|
45
|
+
long_desc <<-LONGDESC
|
46
|
+
`ping` will check that the administration server is up.
|
47
|
+
LONGDESC
|
48
|
+
|
49
|
+
def ping
|
50
|
+
Command::Restricted::Ping.new(
|
51
|
+
*command_params
|
52
|
+
).execute
|
53
|
+
rescue => e
|
54
|
+
catch_errors(e)
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "show NAME_OR_ALIAS",
|
58
|
+
"Show restricted data for a specific node"
|
59
|
+
|
60
|
+
long_desc <<-LONGDESC
|
61
|
+
`show NAME_OR_ALIAS` will try to fetch the restricted data
|
62
|
+
for the specified node. If you just want to see a specific
|
63
|
+
subset of the restricted data you can provide the --filter
|
64
|
+
option separated by a dot for every element.
|
65
|
+
|
66
|
+
With --format <format> option you can choose an output format
|
67
|
+
with the available options table, json or plain. You can also
|
68
|
+
use the shortcut options --table, --json or --plain.
|
69
|
+
|
70
|
+
With --filter <filter> option you can limit the result of
|
71
|
+
printed out elements. You can use any substring that is part
|
72
|
+
of the found elements.
|
73
|
+
LONGDESC
|
74
|
+
|
75
|
+
method_option :format,
|
76
|
+
type: :string,
|
77
|
+
default: "table",
|
78
|
+
banner: "<format>",
|
79
|
+
desc: "Format of the output, valid formats are table, json or plain"
|
80
|
+
|
81
|
+
method_option :table,
|
82
|
+
type: :boolean,
|
83
|
+
default: false,
|
84
|
+
aliases: [],
|
85
|
+
desc: "Format output as table, a shortcut for --format table option"
|
86
|
+
|
87
|
+
method_option :json,
|
88
|
+
type: :boolean,
|
89
|
+
default: false,
|
90
|
+
aliases: [],
|
91
|
+
desc: "Format output as json, a shortcut for --format json option"
|
92
|
+
|
93
|
+
method_option :plain,
|
94
|
+
type: :boolean,
|
95
|
+
default: false,
|
96
|
+
aliases: [],
|
97
|
+
desc: "Format output as plain text, a shortcut for --format plain option"
|
98
|
+
|
99
|
+
method_option :filter,
|
100
|
+
type: :string,
|
101
|
+
default: nil,
|
102
|
+
banner: "<filter>",
|
103
|
+
desc: "Filter by criteria, display only data that contains filter"
|
104
|
+
|
105
|
+
def show(name)
|
106
|
+
Command::Restricted::Show.new(
|
107
|
+
*command_params(
|
108
|
+
name: name
|
109
|
+
)
|
110
|
+
).execute
|
111
|
+
rescue => e
|
112
|
+
catch_errors(e)
|
113
|
+
end
|
114
|
+
|
115
|
+
desc "transition NAME_OR_ALIAS STATE",
|
116
|
+
"Transition a node to a specific state"
|
117
|
+
|
118
|
+
long_desc <<-LONGDESC
|
119
|
+
`transition NAME_OR_ALIAS STATE` will try to transition the
|
120
|
+
specified node into a specified state.
|
121
|
+
LONGDESC
|
122
|
+
|
123
|
+
def transition(name, state)
|
124
|
+
Command::Restricted::Transition.new(
|
125
|
+
*command_params(
|
126
|
+
name: name,
|
127
|
+
state: state
|
128
|
+
)
|
129
|
+
).execute
|
130
|
+
rescue => e
|
131
|
+
catch_errors(e)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2019, SUSE
|
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 SES commands
|
22
|
+
#
|
23
|
+
class Ses < Base
|
24
|
+
desc "upload FILE",
|
25
|
+
"Upload SES configuration file"
|
26
|
+
|
27
|
+
long_desc <<-LONGDESC
|
28
|
+
`upload FILE` will upload yaml file with SES configuration to the
|
29
|
+
server. Data inside this file could be used later for integrating
|
30
|
+
SES cluster with other services.
|
31
|
+
LONGDESC
|
32
|
+
|
33
|
+
#
|
34
|
+
# SES config upload command
|
35
|
+
#
|
36
|
+
# It will upload yaml file with SES configuration to the server.
|
37
|
+
# Data inside this file could be used later for integrating SES
|
38
|
+
# cluster with other services.
|
39
|
+
#
|
40
|
+
# @param file [String] the path to the file
|
41
|
+
#
|
42
|
+
def upload(file)
|
43
|
+
Command::Ses::Upload.new(
|
44
|
+
*command_params(
|
45
|
+
file: file
|
46
|
+
)
|
47
|
+
).execute
|
48
|
+
rescue => e
|
49
|
+
catch_errors(e)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -53,9 +53,15 @@ module Crowbar
|
|
53
53
|
autoload :Repository,
|
54
54
|
File.expand_path("../command/repository", __FILE__)
|
55
55
|
|
56
|
+
autoload :Restricted,
|
57
|
+
File.expand_path("../command/restricted", __FILE__)
|
58
|
+
|
56
59
|
autoload :Role,
|
57
60
|
File.expand_path("../command/role", __FILE__)
|
58
61
|
|
62
|
+
autoload :Ses,
|
63
|
+
File.expand_path("../command/ses", __FILE__)
|
64
|
+
|
59
65
|
autoload :Server,
|
60
66
|
File.expand_path("../command/server", __FILE__)
|
61
67
|
|
@@ -58,6 +58,15 @@ module Crowbar
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def err(message)
|
61
|
+
if message.is_a?(RestClient::Response)
|
62
|
+
begin
|
63
|
+
json = JSON.parse(message.to_s)
|
64
|
+
message = json.fetch("error", message)
|
65
|
+
rescue JSON::ParserError
|
66
|
+
# too bad, this is not what we expected, we'll print the ugly string
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
end
|
61
70
|
raise SimpleCatchableError, message
|
62
71
|
end
|
63
72
|
end
|
@@ -59,7 +59,11 @@ module Crowbar
|
|
59
59
|
|
60
60
|
case result.code
|
61
61
|
when 200
|
62
|
-
|
62
|
+
if options[:raw]
|
63
|
+
result.parsed_response
|
64
|
+
else
|
65
|
+
deployment_cleanup result.parsed_response
|
66
|
+
end
|
63
67
|
when 404
|
64
68
|
err "Failed to preload proposal"
|
65
69
|
else
|
@@ -40,13 +40,19 @@ module Crowbar
|
|
40
40
|
request.process do |request|
|
41
41
|
case request.code
|
42
42
|
when 200
|
43
|
+
content = if options[:raw]
|
44
|
+
content_from(request)
|
45
|
+
else
|
46
|
+
deployment_cleanup(content_from(request))
|
47
|
+
end
|
48
|
+
|
43
49
|
formatter = Formatter::Nested.new(
|
44
50
|
format: provide_format,
|
45
51
|
path: provide_filter,
|
46
52
|
headings: ["Key", "Value"],
|
47
53
|
values: Filter::Subset.new(
|
48
54
|
filter: provide_filter,
|
49
|
-
values:
|
55
|
+
values: content
|
50
56
|
).result
|
51
57
|
)
|
52
58
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2019, SUSE
|
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 Restricted command implementations
|
22
|
+
#
|
23
|
+
module Restricted
|
24
|
+
autoload :Allocate,
|
25
|
+
File.expand_path("../restricted/allocate", __FILE__)
|
26
|
+
|
27
|
+
autoload :Ping,
|
28
|
+
File.expand_path("../restricted/ping", __FILE__)
|
29
|
+
|
30
|
+
autoload :Show,
|
31
|
+
File.expand_path("../restricted/show", __FILE__)
|
32
|
+
|
33
|
+
autoload :Transition,
|
34
|
+
File.expand_path("../restricted/transition", __FILE__)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2019, SUSE
|
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 Command
|
22
|
+
module Restricted
|
23
|
+
#
|
24
|
+
# Implementation for the restricted allocate command
|
25
|
+
#
|
26
|
+
class Allocate < Base
|
27
|
+
def request
|
28
|
+
@request ||= Request::Restricted::Allocate.new(
|
29
|
+
args.easy_merge(
|
30
|
+
action: :allocate
|
31
|
+
)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def execute
|
36
|
+
request.process do |request|
|
37
|
+
case request.code
|
38
|
+
when 200
|
39
|
+
say "Successfully triggered allocate for #{args.name}"
|
40
|
+
when 404
|
41
|
+
err "Node does not exist"
|
42
|
+
else
|
43
|
+
err request.parsed_response["error"]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|