crowbar-client 2.0.0 → 2.1.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 +13 -1
- data/lib/crowbar/client.rb +3 -0
- data/lib/crowbar/client/app.rb +3 -0
- data/lib/crowbar/client/app/barclamp.rb +2 -1
- data/lib/crowbar/client/app/base.rb +0 -34
- data/lib/crowbar/client/app/entry.rb +11 -13
- data/lib/crowbar/client/app/node.rb +28 -0
- data/lib/crowbar/client/app/server.rb +41 -0
- data/lib/crowbar/client/command.rb +3 -0
- data/lib/crowbar/client/command/base.rb +5 -0
- data/lib/crowbar/client/command/node/list.rb +19 -3
- data/lib/crowbar/client/command/node/status.rb +3 -1
- data/lib/crowbar/client/command/server.rb +26 -0
- data/lib/crowbar/client/command/server/api.rb +54 -0
- data/lib/crowbar/client/config.rb +62 -18
- data/lib/crowbar/client/request.rb +3 -0
- data/lib/crowbar/client/request/server.rb +26 -0
- data/lib/crowbar/client/request/server/api.rb +38 -0
- data/lib/crowbar/client/version.rb +1 -1
- data/spec/crowbar/client/command/node/list_spec.rb +3 -1
- data/spec/crowbar/client/command/server/api_spec.rb +39 -0
- data/spec/crowbar/client/request/server/api_spec.rb +52 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af7f5c6bab5cfaf58a39cd195ad78c94641d39b
|
4
|
+
data.tar.gz: 038f95011bd1e449e7c5b3121df21447fc427ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3a803ba5baefeb1c258322cdbaf163bef2c90f40b0eb8344c7d889af337df7abd44860f6c453983fcff71d893ac8940921a9a9774be02668cd2ae3ae4cc917a
|
7
|
+
data.tar.gz: f1ea6e61388e472b8a9be57f304c64b4da1620668f98eb16a2c56ae2a7cca81717e7da25814370dd8aec364e5945488c0649df791f75449e5185c7fa0ec0341c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.1.0](https://github.com/crowbar/crowbar-client/releases/tag/v2.1.0) - 2015-11-25
|
4
|
+
|
5
|
+
* BREAKING
|
6
|
+
* Removed the config file flag, just using default paths (@tboerger)
|
7
|
+
* BUGFIX
|
8
|
+
* Fixed heading for node status (@tboerger)
|
9
|
+
* ENHANCEMENT
|
10
|
+
* Added API help subcommand (@tboerger)
|
11
|
+
* Added switch to hide ready nodes within status (@tboerger)
|
12
|
+
* Added switches to hide names or aliases on node list (@tboerger)
|
13
|
+
* Integrated config values from environment (@tboerger)
|
14
|
+
|
3
15
|
## [2.0.0](https://github.com/crowbar/crowbar-client/releases/tag/v2.0.0) - 2015-11-12
|
4
16
|
|
5
17
|
* BREAKING
|
@@ -7,7 +19,7 @@
|
|
7
19
|
* BUGFIX
|
8
20
|
* Fixed format shortcuts to method instead of class options (@tboerger)
|
9
21
|
* ENHANCEMENT
|
10
|
-
* Be sure to set the correct output format(@tboerger)
|
22
|
+
* Be sure to set the correct output format (@tboerger)
|
11
23
|
|
12
24
|
## [1.0.1](https://github.com/crowbar/crowbar-client/releases/tag/v1.0.1) - 2015-11-11
|
13
25
|
|
data/lib/crowbar/client.rb
CHANGED
data/lib/crowbar/client/app.rb
CHANGED
@@ -27,7 +27,8 @@ module Crowbar
|
|
27
27
|
formats and you can filter the list by any search criteria.
|
28
28
|
|
29
29
|
With --format <format> option you can choose an output format
|
30
|
-
with the available options table, json or plain.
|
30
|
+
with the available options table, json or plain. You can also
|
31
|
+
use the shortcut options --table, --json or --plain.
|
31
32
|
|
32
33
|
With --filter <filter> option you can limit the result of
|
33
34
|
printed out elements. You can use any substring that is part
|
@@ -26,7 +26,6 @@ module Crowbar
|
|
26
26
|
|
27
27
|
Config.configure(
|
28
28
|
options.slice(
|
29
|
-
:config,
|
30
29
|
:alias,
|
31
30
|
:username,
|
32
31
|
:password,
|
@@ -48,39 +47,6 @@ module Crowbar
|
|
48
47
|
exit(exit_code) unless exit_code.nil?
|
49
48
|
end
|
50
49
|
|
51
|
-
def config_parse(path, section)
|
52
|
-
ini = Hashie::Mash.new(
|
53
|
-
IniFile.load(
|
54
|
-
config_detect(path)
|
55
|
-
).to_h
|
56
|
-
)
|
57
|
-
|
58
|
-
if ini[section]
|
59
|
-
ini[section]
|
60
|
-
else
|
61
|
-
Hashie::Mash.new
|
62
|
-
end
|
63
|
-
rescue
|
64
|
-
Hashie::Mash.new
|
65
|
-
end
|
66
|
-
|
67
|
-
def config_detect(path)
|
68
|
-
if path.nil?
|
69
|
-
config_paths.detect do |temp|
|
70
|
-
File.exist? temp
|
71
|
-
end
|
72
|
-
else
|
73
|
-
path
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def config_paths
|
78
|
-
[
|
79
|
-
"#{ENV["HOME"]}/.crowbarrc",
|
80
|
-
"/etc/crowbarrc"
|
81
|
-
]
|
82
|
-
end
|
83
|
-
|
84
50
|
def command_params(args = {})
|
85
51
|
[
|
86
52
|
$stdin,
|
@@ -23,51 +23,45 @@ module Crowbar
|
|
23
23
|
"-v"
|
24
24
|
] => :version
|
25
25
|
|
26
|
-
class_option :config,
|
27
|
-
type: :string,
|
28
|
-
default: nil,
|
29
|
-
aliases: ["-c"],
|
30
|
-
desc: "Path to a configuration file"
|
31
|
-
|
32
26
|
class_option :alias,
|
33
27
|
type: :string,
|
34
|
-
default:
|
28
|
+
default: Config.defaults[:alias],
|
35
29
|
aliases: ["-a"],
|
36
30
|
desc: "Alias for a config section"
|
37
31
|
|
38
32
|
class_option :username,
|
39
33
|
type: :string,
|
40
|
-
default:
|
34
|
+
default: Config.defaults[:username],
|
41
35
|
aliases: ["-U"],
|
42
36
|
desc: "Specify username for connection"
|
43
37
|
|
44
38
|
class_option :password,
|
45
39
|
type: :string,
|
46
|
-
default:
|
40
|
+
default: Config.defaults[:password],
|
47
41
|
aliases: ["-P"],
|
48
42
|
desc: "Specify password for connection"
|
49
43
|
|
50
44
|
class_option :server,
|
51
45
|
type: :string,
|
52
|
-
default:
|
46
|
+
default: Config.defaults[:server],
|
53
47
|
aliases: ["-s"],
|
54
48
|
desc: "Specify server for connection"
|
55
49
|
|
56
50
|
class_option :timeout,
|
57
51
|
type: :numeric,
|
58
|
-
default:
|
52
|
+
default: Config.defaults[:timeout],
|
59
53
|
aliases: ["-t"],
|
60
54
|
desc: "Specify timeout for connection"
|
61
55
|
|
62
56
|
class_option :anonymous,
|
63
57
|
type: :boolean,
|
64
|
-
default:
|
58
|
+
default: Config.defaults[:anonymous],
|
65
59
|
aliases: ["-a"],
|
66
60
|
desc: "Skip API user authentication"
|
67
61
|
|
68
62
|
class_option :debug,
|
69
63
|
type: :boolean,
|
70
|
-
default:
|
64
|
+
default: Config.defaults[:debug],
|
71
65
|
aliases: ["-d"],
|
72
66
|
desc: "Output more debug information"
|
73
67
|
|
@@ -115,6 +109,10 @@ module Crowbar
|
|
115
109
|
desc "role [COMMANDS]",
|
116
110
|
"Role specific commands, call without params for help"
|
117
111
|
subcommand "role", Crowbar::Client::App::Role
|
112
|
+
|
113
|
+
desc "server [COMMANDS]",
|
114
|
+
"Server specific commands, call without params for help"
|
115
|
+
subcommand "server", Crowbar::Client::App::Server
|
118
116
|
end
|
119
117
|
end
|
120
118
|
end
|
@@ -34,6 +34,10 @@ module Crowbar
|
|
34
34
|
With --filter <filter> option you can limit the result of
|
35
35
|
printed out elements. You can use any substring that is part
|
36
36
|
of the found elements.
|
37
|
+
|
38
|
+
With --no-ready switch you can hide all nodes that already
|
39
|
+
transitioned to the ready state, per default the listing will
|
40
|
+
display all nodes.
|
37
41
|
LONGDESC
|
38
42
|
|
39
43
|
method_option :format,
|
@@ -66,6 +70,12 @@ module Crowbar
|
|
66
70
|
banner: "<filter>",
|
67
71
|
desc: "Filter by criteria, display only data that contains filter"
|
68
72
|
|
73
|
+
method_option :ready,
|
74
|
+
type: :boolean,
|
75
|
+
default: true,
|
76
|
+
aliases: [],
|
77
|
+
desc: "Show or hide the nodes that already transitioned to ready"
|
78
|
+
|
69
79
|
def status
|
70
80
|
Command::Node::Status.new(
|
71
81
|
*command_params
|
@@ -90,6 +100,12 @@ module Crowbar
|
|
90
100
|
With --filter <filter> option you can limit the result of
|
91
101
|
printed out elements. You can use any substring that is part
|
92
102
|
of the found elements.
|
103
|
+
|
104
|
+
With --no-aliases switch you can disable the output of the node
|
105
|
+
aliases, per default the listing will display them.
|
106
|
+
|
107
|
+
With --no-names switch you can disable the output of the node
|
108
|
+
names, per default the listing will display them.
|
93
109
|
LONGDESC
|
94
110
|
|
95
111
|
method_option :format,
|
@@ -122,6 +138,18 @@ module Crowbar
|
|
122
138
|
banner: "<filter>",
|
123
139
|
desc: "Filter by criteria, display only data that contains filter"
|
124
140
|
|
141
|
+
method_option :aliases,
|
142
|
+
type: :boolean,
|
143
|
+
default: true,
|
144
|
+
aliases: [],
|
145
|
+
desc: "Show or hide the aliases for the available nodes within listing"
|
146
|
+
|
147
|
+
method_option :names,
|
148
|
+
type: :boolean,
|
149
|
+
default: true,
|
150
|
+
aliases: [],
|
151
|
+
desc: "Show or hide the names for the available nodes within listing"
|
152
|
+
|
125
153
|
def list
|
126
154
|
Command::Node::List.new(
|
127
155
|
*command_params
|
@@ -0,0 +1,41 @@
|
|
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 App
|
20
|
+
class Server < Base
|
21
|
+
desc "api BARCLAMP",
|
22
|
+
"Show the API documentation"
|
23
|
+
|
24
|
+
long_desc <<-LONGDESC
|
25
|
+
`api BARCLAMP` will print out the API documentation that is
|
26
|
+
available for the specified barclamp.
|
27
|
+
LONGDESC
|
28
|
+
|
29
|
+
def api(barclamp)
|
30
|
+
Command::Server::Api.new(
|
31
|
+
*command_params(
|
32
|
+
barclamp: barclamp
|
33
|
+
)
|
34
|
+
).execute
|
35
|
+
rescue SimpleCatchableError => e
|
36
|
+
err e.message, 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -34,7 +34,7 @@ module Crowbar
|
|
34
34
|
when 200
|
35
35
|
formatter = Formatter::Hash.new(
|
36
36
|
format: provide_format,
|
37
|
-
headings:
|
37
|
+
headings: headings,
|
38
38
|
values: Filter::Hash.new(
|
39
39
|
filter: provide_filter,
|
40
40
|
values: content_from(request)
|
@@ -54,16 +54,32 @@ module Crowbar
|
|
54
54
|
|
55
55
|
protected
|
56
56
|
|
57
|
+
def headings
|
58
|
+
[].tap do |values|
|
59
|
+
values.push("Name") if options["names"]
|
60
|
+
values.push("Alias") if options["aliases"]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
57
64
|
def content_from(request)
|
58
65
|
[].tap do |row|
|
59
66
|
request.parsed_response["nodes"].each do |child|
|
67
|
+
values = {}
|
68
|
+
values[:name] = child["name"] if options["names"]
|
69
|
+
values[:alias] = child["alias"] if options["aliases"]
|
70
|
+
|
60
71
|
row.push(
|
61
|
-
|
62
|
-
alias: child["alias"]
|
72
|
+
values
|
63
73
|
)
|
64
74
|
end
|
65
75
|
end
|
66
76
|
end
|
77
|
+
|
78
|
+
def checks
|
79
|
+
msg = "Please provide only names or aliases switch"
|
80
|
+
raise BadOptionsError,
|
81
|
+
msg unless options["names"] || options["aliases"]
|
82
|
+
end
|
67
83
|
end
|
68
84
|
end
|
69
85
|
end
|
@@ -34,7 +34,7 @@ module Crowbar
|
|
34
34
|
when 200
|
35
35
|
formatter = Formatter::Hash.new(
|
36
36
|
format: provide_format,
|
37
|
-
headings: ["Name", "
|
37
|
+
headings: ["Name", "Status"],
|
38
38
|
values: Filter::Hash.new(
|
39
39
|
filter: provide_filter,
|
40
40
|
values: content_from(request)
|
@@ -57,6 +57,8 @@ module Crowbar
|
|
57
57
|
def content_from(request)
|
58
58
|
[].tap do |row|
|
59
59
|
request.parsed_response["nodes"].each do |name, value|
|
60
|
+
next if value["status"] == "Ready" && !options["ready"]
|
61
|
+
|
60
62
|
row.push(
|
61
63
|
name: name,
|
62
64
|
status: value["status"]
|
@@ -0,0 +1,26 @@
|
|
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 Server
|
21
|
+
autoload :Api,
|
22
|
+
File.expand_path("../server/api", __FILE__)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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 Server
|
21
|
+
class Api < Base
|
22
|
+
include Mixin::Barclamp
|
23
|
+
|
24
|
+
def request
|
25
|
+
@request ||= Request::Server::Api.new(
|
26
|
+
args
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def execute
|
31
|
+
validate_barclamp! args.barclamp
|
32
|
+
|
33
|
+
request.process do |request|
|
34
|
+
case request.code
|
35
|
+
when 200
|
36
|
+
say JSON.pretty_generate(
|
37
|
+
content_from(request)
|
38
|
+
)
|
39
|
+
else
|
40
|
+
err request.parsed_response["error"]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
def content_from(request)
|
48
|
+
request.parsed_response
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -38,14 +38,13 @@ module Crowbar
|
|
38
38
|
|
39
39
|
def defaults
|
40
40
|
@defaults ||= Hashie::Mash.new(
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
debug: false
|
41
|
+
alias: default_alias,
|
42
|
+
username: default_username,
|
43
|
+
password: default_password,
|
44
|
+
server: default_server,
|
45
|
+
timeout: default_timeout,
|
46
|
+
anonymous: default_anonymous,
|
47
|
+
debug: default_debug
|
49
48
|
)
|
50
49
|
end
|
51
50
|
|
@@ -63,6 +62,50 @@ module Crowbar
|
|
63
62
|
|
64
63
|
protected
|
65
64
|
|
65
|
+
def default_alias
|
66
|
+
ENV["CROWBAR_ALIAS"] || "default"
|
67
|
+
end
|
68
|
+
|
69
|
+
def default_username
|
70
|
+
ENV["CROWBAR_USERNAME"] || "crowbar"
|
71
|
+
end
|
72
|
+
|
73
|
+
def default_password
|
74
|
+
ENV["CROWBAR_PASSWORD"] || "crowbar"
|
75
|
+
end
|
76
|
+
|
77
|
+
def default_server
|
78
|
+
ENV["CROWBAR_SERVER"] || "http://127.0.0.1:80"
|
79
|
+
end
|
80
|
+
|
81
|
+
def default_timeout
|
82
|
+
if ENV["CROWBAR_TIMEOUT"].present?
|
83
|
+
ENV["CROWBAR_TIMEOUT"].to_i
|
84
|
+
else
|
85
|
+
60
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def default_anonymous
|
90
|
+
if ENV["CROWBAR_ANONYMOUS"].present?
|
91
|
+
[
|
92
|
+
true, 1, "1", "t", "T", "true", "TRUE"
|
93
|
+
].include? ENV["CROWBAR_ANONYMOUS"]
|
94
|
+
else
|
95
|
+
false
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def default_debug
|
100
|
+
if ENV["CROWBAR_DEBUG"].present?
|
101
|
+
[
|
102
|
+
true, 1, "1", "t", "T", "true", "TRUE"
|
103
|
+
].include? ENV["CROWBAR_ANONYMOUS"]
|
104
|
+
else
|
105
|
+
false
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
66
109
|
def merge
|
67
110
|
result = {}.tap do |overwrite|
|
68
111
|
defaults.keys.each do |key|
|
@@ -101,21 +144,22 @@ module Crowbar
|
|
101
144
|
end
|
102
145
|
|
103
146
|
def finder
|
104
|
-
|
105
|
-
|
106
|
-
File.exist? temp
|
107
|
-
end
|
108
|
-
else
|
109
|
-
options.config
|
147
|
+
paths.detect do |temp|
|
148
|
+
File.exist? temp
|
110
149
|
end
|
111
150
|
end
|
112
151
|
|
113
152
|
def paths
|
114
153
|
[
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
154
|
+
File.join(
|
155
|
+
ENV["HOME"],
|
156
|
+
".crowbarrc"
|
157
|
+
),
|
158
|
+
File.join(
|
159
|
+
"/etc",
|
160
|
+
"crowbarrc"
|
161
|
+
)
|
162
|
+
]
|
119
163
|
end
|
120
164
|
|
121
165
|
class << self
|
@@ -0,0 +1,26 @@
|
|
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 Request
|
20
|
+
module Server
|
21
|
+
autoload :Api,
|
22
|
+
File.expand_path("../server/api", __FILE__)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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 Request
|
20
|
+
module Server
|
21
|
+
class Api < Base
|
22
|
+
def method
|
23
|
+
:get
|
24
|
+
end
|
25
|
+
|
26
|
+
def url
|
27
|
+
[
|
28
|
+
"crowbar",
|
29
|
+
attrs.barclamp,
|
30
|
+
"1.0",
|
31
|
+
"help"
|
32
|
+
].join("/")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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
|
+
require_relative "../../../../spec_helper"
|
18
|
+
|
19
|
+
describe "Crowbar::Client::Command::Server::Api" do
|
20
|
+
include_context "command_context"
|
21
|
+
|
22
|
+
subject do
|
23
|
+
::Crowbar::Client::Command::Server::Api.new(
|
24
|
+
stdin,
|
25
|
+
stdout,
|
26
|
+
stderr
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should always return a request class" do
|
31
|
+
expect(subject.request).to(
|
32
|
+
be_a(
|
33
|
+
::Crowbar::Client::Request::Server::Api
|
34
|
+
)
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
pending
|
39
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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
|
+
require_relative "../../../../spec_helper"
|
18
|
+
|
19
|
+
describe "Crowbar::Client::Request::Server::Api" do
|
20
|
+
it_behaves_like "a request class" do
|
21
|
+
subject do
|
22
|
+
::Crowbar::Client::Request::Server::Api.new(
|
23
|
+
attrs
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
let!(:attrs) do
|
28
|
+
{
|
29
|
+
barclamp: "ntp"
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
let!(:params) do
|
34
|
+
{}
|
35
|
+
end
|
36
|
+
|
37
|
+
let!(:method) do
|
38
|
+
:get
|
39
|
+
end
|
40
|
+
|
41
|
+
let!(:url) do
|
42
|
+
"crowbar/ntp/1.0/help"
|
43
|
+
end
|
44
|
+
|
45
|
+
let!(:headers) do
|
46
|
+
{
|
47
|
+
"Content-Type" => "application/json",
|
48
|
+
"Accept" => "application/json"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowbar-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Boerger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/crowbar/client/app/repository.rb
|
221
221
|
- lib/crowbar/client/app/reset.rb
|
222
222
|
- lib/crowbar/client/app/role.rb
|
223
|
+
- lib/crowbar/client/app/server.rb
|
223
224
|
- lib/crowbar/client/app/virtual_ip.rb
|
224
225
|
- lib/crowbar/client/command.rb
|
225
226
|
- lib/crowbar/client/command/barclamp.rb
|
@@ -272,6 +273,8 @@ files:
|
|
272
273
|
- lib/crowbar/client/command/role.rb
|
273
274
|
- lib/crowbar/client/command/role/list.rb
|
274
275
|
- lib/crowbar/client/command/role/show.rb
|
276
|
+
- lib/crowbar/client/command/server.rb
|
277
|
+
- lib/crowbar/client/command/server/api.rb
|
275
278
|
- lib/crowbar/client/command/virtual_ip.rb
|
276
279
|
- lib/crowbar/client/command/virtual_ip/allocate.rb
|
277
280
|
- lib/crowbar/client/command/virtual_ip/deallocate.rb
|
@@ -334,6 +337,8 @@ files:
|
|
334
337
|
- lib/crowbar/client/request/role.rb
|
335
338
|
- lib/crowbar/client/request/role/list.rb
|
336
339
|
- lib/crowbar/client/request/role/show.rb
|
340
|
+
- lib/crowbar/client/request/server.rb
|
341
|
+
- lib/crowbar/client/request/server/api.rb
|
337
342
|
- lib/crowbar/client/request/virtual_ip.rb
|
338
343
|
- lib/crowbar/client/request/virtual_ip/allocate.rb
|
339
344
|
- lib/crowbar/client/request/virtual_ip/deallocate.rb
|
@@ -382,6 +387,7 @@ files:
|
|
382
387
|
- spec/crowbar/client/command/reset/proposal_spec.rb
|
383
388
|
- spec/crowbar/client/command/role/list_spec.rb
|
384
389
|
- spec/crowbar/client/command/role/show_spec.rb
|
390
|
+
- spec/crowbar/client/command/server/api_spec.rb
|
385
391
|
- spec/crowbar/client/command/virtual_ip/allocate_spec.rb
|
386
392
|
- spec/crowbar/client/command/virtual_ip/deallocate_spec.rb
|
387
393
|
- spec/crowbar/client/filter/array_spec.rb
|
@@ -423,6 +429,7 @@ files:
|
|
423
429
|
- spec/crowbar/client/request/reset/proposal_spec.rb
|
424
430
|
- spec/crowbar/client/request/role/list_spec.rb
|
425
431
|
- spec/crowbar/client/request/role/show_spec.rb
|
432
|
+
- spec/crowbar/client/request/server/api_spec.rb
|
426
433
|
- spec/crowbar/client/request/virtual_ip/allocate_spec.rb
|
427
434
|
- spec/crowbar/client/request/virtual_ip/deallocate_spec.rb
|
428
435
|
- spec/crowbar/client/util/editor_spec.rb
|
@@ -469,6 +476,7 @@ test_files:
|
|
469
476
|
- spec/crowbar/client/util/runner_spec.rb
|
470
477
|
- spec/crowbar/client/command/host_ip/allocate_spec.rb
|
471
478
|
- spec/crowbar/client/command/host_ip/deallocate_spec.rb
|
479
|
+
- spec/crowbar/client/command/server/api_spec.rb
|
472
480
|
- spec/crowbar/client/command/repository/activate_all_spec.rb
|
473
481
|
- spec/crowbar/client/command/repository/deactivate_spec.rb
|
474
482
|
- spec/crowbar/client/command/repository/list_spec.rb
|
@@ -512,6 +520,7 @@ test_files:
|
|
512
520
|
- spec/crowbar/client/request/party_spec.rb
|
513
521
|
- spec/crowbar/client/request/host_ip/allocate_spec.rb
|
514
522
|
- spec/crowbar/client/request/host_ip/deallocate_spec.rb
|
523
|
+
- spec/crowbar/client/request/server/api_spec.rb
|
515
524
|
- spec/crowbar/client/request/repository/activate_all_spec.rb
|
516
525
|
- spec/crowbar/client/request/repository/deactivate_spec.rb
|
517
526
|
- spec/crowbar/client/request/repository/list_spec.rb
|