crowbar-client 3.7.0 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/crowbar/client/app.rb +3 -0
- data/lib/crowbar/client/app/entry.rb +6 -0
- data/lib/crowbar/client/app/proposal.rb +20 -0
- data/lib/crowbar/client/app/restricted.rb +136 -0
- data/lib/crowbar/client/command.rb +3 -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/request.rb +3 -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/version.rb +1 -1
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 578a4e1672fb4e6d3310494b6f9e4e0528f915af8120fb31413401df43a255fe
|
4
|
+
data.tar.gz: 422038df0820c6a5a19ed4289fedbd7058fdcf0f87c6d1b08153a6fc45fe5044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9db8d99338f99c3e052672fc7fa4d5fdd799ae0f3a78c5d58f6a420857567838a7d3812db51f380077b1e53485d49aeb8bd5e469a42145871f333de66cbe7578
|
7
|
+
data.tar.gz: 9ddf99523a722848990ab5eb54ebc9c757b4a55e5ed2b316f2707491273f99867dc709ee8226fd33d9153c3a05c078dbe97df805b4bd89c8cd9da280947c1b4e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.9.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.9.0) - 2019-04-05
|
4
|
+
|
5
|
+
* ENHANCEMENT
|
6
|
+
* Add support for the restricted APIs
|
7
|
+
* Add --raw to "proposal show" & "proposal edit"
|
8
|
+
* Correctly parse error messages that we don't handle natively
|
9
|
+
|
10
|
+
## [3.8.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.8.0) - 2019-04-02
|
11
|
+
|
12
|
+
* ENHANCEMENT
|
13
|
+
* Add 'ses' subcommand to upload SES configuration file to crowbar (@skazi0)
|
14
|
+
|
3
15
|
## [3.7.0](https://github.com/crowbar/crowbar-client/releases/tag/v3.7.0) - 2018-12-14
|
4
16
|
|
5
17
|
* ENHANCEMENT
|
data/lib/crowbar/client/app.rb
CHANGED
@@ -171,8 +171,14 @@ module Crowbar
|
|
171
171
|
"SES (Ceph) specific commands, call without params for help"
|
172
172
|
subcommand "ses", Crowbar::Client::App::Ses
|
173
173
|
|
174
|
+
desc "restricted [COMMANDS]",
|
175
|
+
"Commands specifc to restricted clients, call without params for help"
|
176
|
+
subcommand "restricted", Crowbar::Client::App::Restricted
|
177
|
+
|
174
178
|
# hide SES command in older versions
|
175
179
|
remove_command :ses unless Config.defaults[:cloud_version].to_i >= 9
|
180
|
+
# hide Restricted command in older versions
|
181
|
+
remove_command :restricted unless Config.defaults[:cloud_version].to_i >= 9
|
176
182
|
end
|
177
183
|
end
|
178
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
|
@@ -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
|
@@ -0,0 +1,45 @@
|
|
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
|
+
module Restricted
|
21
|
+
#
|
22
|
+
# Implementation for the restricted ping command
|
23
|
+
#
|
24
|
+
class Ping < Base
|
25
|
+
def request
|
26
|
+
@request ||= Request::Restricted::Ping.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 pinged the administration server"
|
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,72 @@
|
|
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
|
+
module Restricted
|
21
|
+
#
|
22
|
+
# Implementation for the restricted show command
|
23
|
+
#
|
24
|
+
class Show < Base
|
25
|
+
include Mixin::Format
|
26
|
+
include Mixin::Filter
|
27
|
+
|
28
|
+
def request
|
29
|
+
@request ||= Request::Restricted::Show.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
|
+
path: provide_filter,
|
41
|
+
headings: ["Key", "Value"],
|
42
|
+
values: Filter::Subset.new(
|
43
|
+
filter: provide_filter,
|
44
|
+
values: content_from(request)
|
45
|
+
).result
|
46
|
+
)
|
47
|
+
|
48
|
+
if formatter.empty?
|
49
|
+
err "No result"
|
50
|
+
elsif args.name == "help"
|
51
|
+
err "Node does not exist"
|
52
|
+
else
|
53
|
+
say formatter.result
|
54
|
+
end
|
55
|
+
when 404
|
56
|
+
err "Node does not exist"
|
57
|
+
else
|
58
|
+
err request.parsed_response["error"]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
protected
|
64
|
+
|
65
|
+
def content_from(request)
|
66
|
+
request.parsed_response
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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
|
+
module Restricted
|
21
|
+
#
|
22
|
+
# Implementation for the restricted transition command
|
23
|
+
#
|
24
|
+
class Transition < Base
|
25
|
+
def request
|
26
|
+
@request ||= Request::Restricted::Transition.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 transitioned to #{args.state}"
|
36
|
+
when 404
|
37
|
+
err "Node does not exist"
|
38
|
+
else
|
39
|
+
err request.parsed_response["error"]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -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 Request
|
20
|
+
#
|
21
|
+
# Module for the Restricted request 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,50 @@
|
|
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 Request
|
20
|
+
module Restricted
|
21
|
+
#
|
22
|
+
# Implementation for the restricted allocate request
|
23
|
+
#
|
24
|
+
class Allocate < Base
|
25
|
+
#
|
26
|
+
# HTTP method that gets used by the request
|
27
|
+
#
|
28
|
+
# @return [Symbol] the method for the request
|
29
|
+
#
|
30
|
+
def method
|
31
|
+
:post
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Path to the API endpoint for the request
|
36
|
+
#
|
37
|
+
# @return [String] path to the API endpoint
|
38
|
+
#
|
39
|
+
def url
|
40
|
+
[
|
41
|
+
"restricted",
|
42
|
+
"allocate",
|
43
|
+
attrs.name
|
44
|
+
].join("/")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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 Request
|
20
|
+
module Restricted
|
21
|
+
#
|
22
|
+
# Implementation for the restricted ping request
|
23
|
+
#
|
24
|
+
class Ping < Base
|
25
|
+
#
|
26
|
+
# HTTP method that gets used by the request
|
27
|
+
#
|
28
|
+
# @return [Symbol] the method for the request
|
29
|
+
#
|
30
|
+
def method
|
31
|
+
:get
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Path to the API endpoint for the request
|
36
|
+
#
|
37
|
+
# @return [String] path to the API endpoint
|
38
|
+
#
|
39
|
+
def url
|
40
|
+
[
|
41
|
+
"restricted",
|
42
|
+
"ping"
|
43
|
+
].join("/")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,50 @@
|
|
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 Request
|
20
|
+
module Restricted
|
21
|
+
#
|
22
|
+
# Implementation for the restricted show request
|
23
|
+
#
|
24
|
+
class Show < Base
|
25
|
+
#
|
26
|
+
# HTTP method that gets used by the request
|
27
|
+
#
|
28
|
+
# @return [Symbol] the method for the request
|
29
|
+
#
|
30
|
+
def method
|
31
|
+
:get
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Path to the API endpoint for the request
|
36
|
+
#
|
37
|
+
# @return [String] path to the API endpoint
|
38
|
+
#
|
39
|
+
def url
|
40
|
+
[
|
41
|
+
"restricted",
|
42
|
+
"show",
|
43
|
+
attrs.name
|
44
|
+
].join("/")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,63 @@
|
|
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 Request
|
22
|
+
module Restricted
|
23
|
+
#
|
24
|
+
# Implementation for the restricted transition request
|
25
|
+
#
|
26
|
+
class Transition < Base
|
27
|
+
#
|
28
|
+
# Override the request content
|
29
|
+
#
|
30
|
+
# @return [Hash] the content for the request
|
31
|
+
#
|
32
|
+
def content
|
33
|
+
super.easy_merge!(
|
34
|
+
state: attrs.state
|
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
|
+
"restricted",
|
55
|
+
"transition",
|
56
|
+
attrs.name
|
57
|
+
].join("/")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
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.
|
4
|
+
version: 3.9.0
|
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: 2019-04-
|
13
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -244,6 +244,7 @@ files:
|
|
244
244
|
- lib/crowbar/client/app/node.rb
|
245
245
|
- lib/crowbar/client/app/proposal.rb
|
246
246
|
- lib/crowbar/client/app/repository.rb
|
247
|
+
- lib/crowbar/client/app/restricted.rb
|
247
248
|
- lib/crowbar/client/app/role.rb
|
248
249
|
- lib/crowbar/client/app/server.rb
|
249
250
|
- lib/crowbar/client/app/services.rb
|
@@ -310,6 +311,11 @@ files:
|
|
310
311
|
- lib/crowbar/client/command/repository/deactivate.rb
|
311
312
|
- lib/crowbar/client/command/repository/deactivate_all.rb
|
312
313
|
- lib/crowbar/client/command/repository/list.rb
|
314
|
+
- lib/crowbar/client/command/restricted.rb
|
315
|
+
- lib/crowbar/client/command/restricted/allocate.rb
|
316
|
+
- lib/crowbar/client/command/restricted/ping.rb
|
317
|
+
- lib/crowbar/client/command/restricted/show.rb
|
318
|
+
- lib/crowbar/client/command/restricted/transition.rb
|
313
319
|
- lib/crowbar/client/command/role.rb
|
314
320
|
- lib/crowbar/client/command/role/list.rb
|
315
321
|
- lib/crowbar/client/command/role/show.rb
|
@@ -422,6 +428,11 @@ files:
|
|
422
428
|
- lib/crowbar/client/request/repository/deactivate_all.rb
|
423
429
|
- lib/crowbar/client/request/repository/list.rb
|
424
430
|
- lib/crowbar/client/request/rest.rb
|
431
|
+
- lib/crowbar/client/request/restricted.rb
|
432
|
+
- lib/crowbar/client/request/restricted/allocate.rb
|
433
|
+
- lib/crowbar/client/request/restricted/ping.rb
|
434
|
+
- lib/crowbar/client/request/restricted/show.rb
|
435
|
+
- lib/crowbar/client/request/restricted/transition.rb
|
425
436
|
- lib/crowbar/client/request/role.rb
|
426
437
|
- lib/crowbar/client/request/role/list.rb
|
427
438
|
- lib/crowbar/client/request/role/show.rb
|