razor-client 1.7.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.md +12 -0
- data/bin/razor +19 -23
- data/lib/razor/cli/command.rb +3 -3
- data/lib/razor/cli/navigate.rb +55 -1
- data/lib/razor/cli/parse.rb +15 -11
- data/lib/razor/cli/version.rb +1 -1
- data/spec/cli/command_spec.rb +10 -1
- data/spec/cli/navigate_spec.rb +52 -4
- data/spec/cli/parse_spec.rb +1 -2
- data/spec/fixtures/sample_api +1 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/accept-language_header/should_allow_other_accept-language_headers.yml +10 -8
- data/spec/fixtures/vcr/Razor_CLI_Navigate/accept-language_header/should_set_the_accept-language_header.yml +10 -8
- data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_in_string.yml +110 -91
- data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_single-dash_with_single_character_flag.yml +71 -51
- data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_spaces.yml +328 -271
- data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_not_allow_double-dash_with_single_character_flag.yml +52 -40
- data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_not_allow_single-dash_with_multiple_character_flag.yml +49 -37
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_--help_command_.yml +53 -135
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_-h_command_.yml +53 -135
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_--help_.yml +53 -135
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_-h_.yml +53 -135
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_help_.yml +53 -135
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_help_command_.yml +53 -135
- data/spec/fixtures/vcr/Razor_CLI_Navigate/positional_arguments/should_allow_the_use_of_positional_arguments.yml +229 -163
- data/spec/fixtures/vcr/Razor_CLI_Navigate/positional_arguments/should_fail_with_too_many_positional_arguments.yml +49 -37
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_preserve_that_across_navigation.yml +25 -13
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_supply_that_to_the_API_service.yml +14 -8
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_bad_JSON.yml +52 -40
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_malformed_argument.yml +105 -90
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_an_array_into_an_existing_array.yml +549 -446
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_the_arguments_as_an_array.yml +549 -446
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_the_arguments_into_an_existing_array.yml +549 -446
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_construct_a_json_object.yml +71 -51
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_construct_a_json_object_with_unicode.yml +144 -100
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_fail_with_mixed_types_array_then_hash_.yml +52 -40
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_fail_with_mixed_types_hash_then_array_.yml +52 -40
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_no_parameters/should_fail_with_bad_JSON.yml +54 -43
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_append_limit.yml +25 -13
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_append_start.yml +25 -13
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_not_fail_when_query_returns_details_for_one_item.yml +78 -44
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_store_query_without_query_parameters.yml +130 -74
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_throw_an_error_if_the_query_parameter_is_not_in_the_API.yml +14 -8
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_throw_an_error_if_the_query_parameter_is_not_in_the_API_from_a_single_item.yml +66 -38
- data/spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/should_print_a_list_of_known_endpoints.yml +12 -8
- data/spec/spec_helper.rb +4 -1
- data/spec/testing.md +25 -1
- metadata +73 -71
data/NEWS.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Razor Client Release Notes
|
2
2
|
|
3
|
+
## 1.8.1 - 2018-04-23
|
4
|
+
|
5
|
+
* IMPROVEMENT: The default API URL now attempts to use TLS on localhost port
|
6
|
+
8151 before falling back to non-TLS on 8150.
|
7
|
+
* BUGFIX: Removed extra output that was being added.
|
8
|
+
|
9
|
+
## 1.8.0
|
10
|
+
|
11
|
+
* IMPROVEMENT: Now allowing underscores to be mixed into argument lists,
|
12
|
+
e.g. `razor create-broker --name test --broker_type noop`
|
13
|
+
* BUGFIX: Fixed extra output that was being added.
|
14
|
+
|
3
15
|
## 1.7.0 - 2018-01-17
|
4
16
|
|
5
17
|
* NEW: Removed support for Ruby < 2.0
|
data/bin/razor
CHANGED
@@ -14,26 +14,6 @@ def die(message = nil)
|
|
14
14
|
exit 1
|
15
15
|
end
|
16
16
|
|
17
|
-
begin
|
18
|
-
parse = Razor::CLI::Parse.new(ARGV)
|
19
|
-
rescue Razor::CLI::InvalidURIError => e
|
20
|
-
die e.message
|
21
|
-
rescue OptionParser::InvalidOption => e
|
22
|
-
die _("%{error}\nTry 'razor --help' for more information") % {error: e.message}
|
23
|
-
end
|
24
|
-
|
25
|
-
if parse.show_version?
|
26
|
-
version, exit_code = parse.version
|
27
|
-
puts version
|
28
|
-
exit exit_code
|
29
|
-
end
|
30
|
-
|
31
|
-
if parse.show_help? and not parse.show_command_help?
|
32
|
-
output, exitcode = parse.help
|
33
|
-
puts output
|
34
|
-
exit exitcode
|
35
|
-
end
|
36
|
-
|
37
17
|
def unexpected_error(e)
|
38
18
|
die _(<<-ERROR) % {backtrace: e.backtrace.take(10).join("\n"), error: e}
|
39
19
|
An unexpected error has occurred.
|
@@ -50,12 +30,29 @@ https://tickets.puppetlabs.com/browse/RAZOR
|
|
50
30
|
end
|
51
31
|
|
52
32
|
begin
|
53
|
-
|
54
|
-
|
33
|
+
parse = Razor::CLI::Parse.new(ARGV)
|
34
|
+
|
35
|
+
navigate = parse.navigate
|
36
|
+
|
37
|
+
if parse.show_version?
|
38
|
+
version, exit_code = parse.version
|
39
|
+
puts version
|
40
|
+
exit exit_code
|
41
|
+
end
|
42
|
+
|
43
|
+
if parse.show_help? and not parse.show_command_help?
|
44
|
+
output, exitcode = parse.help
|
45
|
+
puts output
|
46
|
+
exit exitcode
|
47
|
+
end
|
48
|
+
|
49
|
+
document = navigate.get_document
|
55
50
|
url = parse.navigate.last_url
|
56
51
|
result = format_document document, parse
|
57
52
|
# TRANSLATORS: This is a template for all results that the client outputs.
|
58
53
|
puts _("From %{url}:\n\n%{result}\n\n") % {url: url, result: result}
|
54
|
+
rescue Razor::CLI::InvalidURIError => e
|
55
|
+
die e.message
|
59
56
|
rescue RestClient::Unauthorized
|
60
57
|
puts _(<<-UNAUTH) % {url: url}
|
61
58
|
Error: Credentials are required to connect to the server at %{url}"
|
@@ -75,7 +72,6 @@ rescue RestClient::SSLCertificateNotVerified
|
|
75
72
|
rescue RestClient::Exception => e
|
76
73
|
r = e.response
|
77
74
|
unexpected_error(e) if r.nil?
|
78
|
-
p r.methods
|
79
75
|
request_type = r.args[:method].to_s.upcase
|
80
76
|
url = r.args[:url]
|
81
77
|
puts _("Error from doing %{request_type} %{url}") % {request_type: request_type, url: url}
|
data/lib/razor/cli/command.rb
CHANGED
@@ -30,15 +30,15 @@ class Razor::CLI::Command
|
|
30
30
|
pos_index = 0
|
31
31
|
until @segments.empty?
|
32
32
|
argument = @segments.shift
|
33
|
-
if argument =~ /\A--([a-z-]
|
33
|
+
if argument =~ /\A--([a-z][a-z_-]+)(=(.+))?\Z/ or
|
34
34
|
argument =~ /\A-([a-z])(=(.+))?\Z/
|
35
35
|
# `--arg=value`/`--arg value`
|
36
36
|
# `-a=value`/`-a value`
|
37
37
|
arg_name, value = [$1, $3]
|
38
|
-
value = @segments.shift if value.nil? && @segments[0] !~
|
38
|
+
value = @segments.shift if value.nil? && @segments[0] !~ /^-/
|
39
39
|
arg_name = self.class.resolve_alias(arg_name, @cmd_schema)
|
40
40
|
body[arg_name] = self.class.convert_arg(arg_name, value, body[arg_name], @cmd_schema)
|
41
|
-
elsif argument =~ /\A-([a-z-]
|
41
|
+
elsif argument =~ /\A-([a-z][a-z_-]+)(=(.+))?\Z/ and
|
42
42
|
@cmd_schema[self.class.resolve_alias($1, @cmd_schema)]
|
43
43
|
# Short form, should be long; offer suggestion
|
44
44
|
raise ArgumentError, _("Unexpected argument %{argument} (did you mean %{suggestion}?)") % {argument: argument, suggestion: "--#{$1}"}
|
data/lib/razor/cli/navigate.rb
CHANGED
@@ -5,14 +5,47 @@ require 'forwardable'
|
|
5
5
|
|
6
6
|
module Razor::CLI
|
7
7
|
class Navigate
|
8
|
+
RAZOR_HTTPS_API = "https://localhost:8151/api"
|
9
|
+
RAZOR_HTTP_API = "http://localhost:8150/api"
|
8
10
|
extend Forwardable
|
9
11
|
|
10
12
|
def initialize(parse, segments)
|
11
13
|
@parse = parse
|
12
14
|
@segments = segments||[]
|
15
|
+
set_api_url!(parse)
|
13
16
|
@doc = entrypoint
|
14
17
|
@doc_resource = create_resource parse.api_url, {:accept => :json,
|
15
|
-
|
18
|
+
:accept_language => accept_language}
|
19
|
+
end
|
20
|
+
|
21
|
+
# This returns an array of two elements:
|
22
|
+
# - The URL that, if neither the `-u` argument nor the
|
23
|
+
# RAZOR_API environment variable are set, will be used.
|
24
|
+
# - The source from which the URL was found, `:https` or `:http`.
|
25
|
+
def default_api
|
26
|
+
if https_api_exists?
|
27
|
+
[RAZOR_HTTPS_API, :https]
|
28
|
+
else
|
29
|
+
[RAZOR_HTTP_API, :http]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# The order of API selection works as follows:
|
34
|
+
# - Use `-u` argument if defined (done elsewhere)
|
35
|
+
# - Use "RAZOR_API" environment variable if defined
|
36
|
+
# - Check PE's https://localhost:8151/api via `HEAD` HTTP method
|
37
|
+
# - Use FOSS' http://localhost:8150/api
|
38
|
+
# This receives an argument determining whether to be verbose about
|
39
|
+
# requests made.
|
40
|
+
def set_api_url!(parse)
|
41
|
+
if !!parse.api_url
|
42
|
+
parse.api_url.to_s
|
43
|
+
elsif ENV["RAZOR_API"]
|
44
|
+
parse.parse_and_set_api_url(ENV['RAZOR_API'], :env)
|
45
|
+
else
|
46
|
+
url, source = default_api
|
47
|
+
parse.parse_and_set_api_url(url, source)
|
48
|
+
end
|
16
49
|
end
|
17
50
|
|
18
51
|
attr_accessor :doc_resource
|
@@ -112,6 +145,13 @@ module Razor::CLI
|
|
112
145
|
@accept_language ||= GettextSetup.candidate_locales
|
113
146
|
end
|
114
147
|
|
148
|
+
def head(url, headers={})
|
149
|
+
resource = create_resource(url, headers)
|
150
|
+
response = resource.head
|
151
|
+
print "HEAD #{url.to_s}\n#{response.body}\n\n" if @parse.dump_response?
|
152
|
+
response
|
153
|
+
end
|
154
|
+
|
115
155
|
def get(url, headers={})
|
116
156
|
resource = create_resource(url, headers)
|
117
157
|
response = resource.get
|
@@ -153,6 +193,20 @@ module Razor::CLI
|
|
153
193
|
end
|
154
194
|
|
155
195
|
private
|
196
|
+
def https_api_exists?
|
197
|
+
# No need to verify SSL on localhost, cert won't match.
|
198
|
+
old_verify_ssl = @parse.verify_ssl?
|
199
|
+
@parse.verify_ssl = false
|
200
|
+
begin
|
201
|
+
url = RAZOR_HTTPS_API
|
202
|
+
head(URI.parse(url))
|
203
|
+
rescue Errno::ENOENT, Errno::ECONNREFUSED
|
204
|
+
false
|
205
|
+
ensure
|
206
|
+
print "HEAD #{url.to_s}\n\n" if @parse.dump_response?
|
207
|
+
@parse.verify_ssl = old_verify_ssl
|
208
|
+
end
|
209
|
+
end
|
156
210
|
|
157
211
|
def create_resource(url, headers)
|
158
212
|
@doc_resource = RestClient::Resource.new(url.to_s,
|
data/lib/razor/cli/parse.rb
CHANGED
@@ -16,7 +16,6 @@ module Razor::CLI
|
|
16
16
|
|
17
17
|
class Parse
|
18
18
|
extend Forwardable
|
19
|
-
DEFAULT_RAZOR_API = "http://localhost:8150/api"
|
20
19
|
|
21
20
|
def_delegator 'navigate', 'query?'
|
22
21
|
|
@@ -39,7 +38,9 @@ module Razor::CLI
|
|
39
38
|
opts.on "-u", "--url URL",
|
40
39
|
_("The full Razor API URL, can also be set\n" + " "*37 +
|
41
40
|
"with the RAZOR_API environment variable\n" + " "*37 +
|
42
|
-
"(default %{
|
41
|
+
"(default %{https_api} or \n" + " "*37 +
|
42
|
+
"%{http_api})") % {http_api: Razor::CLI::Navigate::RAZOR_HTTP_API,
|
43
|
+
https_api: Razor::CLI::Navigate::RAZOR_HTTPS_API} do |url|
|
43
44
|
parse_and_set_api_url(url, :opts)
|
44
45
|
end
|
45
46
|
|
@@ -147,6 +148,10 @@ ERR
|
|
147
148
|
!!@dump
|
148
149
|
end
|
149
150
|
|
151
|
+
def verify_ssl=(arg)
|
152
|
+
@verify_ssl = arg
|
153
|
+
end
|
154
|
+
|
150
155
|
def verify_ssl?
|
151
156
|
!!@verify_ssl
|
152
157
|
end
|
@@ -158,12 +163,13 @@ ERR
|
|
158
163
|
LINUX_PEM_FILE = '/etc/puppetlabs/puppet/ssl/certs/ca.pem'
|
159
164
|
WIN_PEM_FILE = 'C:\ProgramData\PuppetLabs\puppet\etc\ssl\certs\ca.pem'
|
160
165
|
def initialize(args)
|
161
|
-
parse_and_set_api_url(ENV["RAZOR_API"] || DEFAULT_RAZOR_API, :env)
|
162
166
|
@args = args.dup
|
163
167
|
# To be populated externally.
|
164
168
|
@stripped_args = []
|
165
169
|
@format = 'short'
|
166
170
|
@verify_ssl = true
|
171
|
+
@args = get_optparse.order(@args)
|
172
|
+
parse_and_set_api_url(ENV["RAZOR_API"], :env) if ENV["RAZOR_API"] && !@api_url
|
167
173
|
env_pem_file = ENV['RAZOR_CA_FILE']
|
168
174
|
# If this is set, it should actually exist.
|
169
175
|
if env_pem_file && !File.exists?(env_pem_file)
|
@@ -176,13 +182,6 @@ ERR
|
|
176
182
|
break
|
177
183
|
end
|
178
184
|
end
|
179
|
-
@args = get_optparse.order(@args)
|
180
|
-
|
181
|
-
# Localhost won't match the server's certificate; no verification required.
|
182
|
-
# This needs to happen after get_optparse so `-k` and `-u` can take effect.
|
183
|
-
if @api_url.hostname == 'localhost'
|
184
|
-
@verify_ssl = false
|
185
|
-
end
|
186
185
|
|
187
186
|
@args = set_help_vars(@args)
|
188
187
|
if @args == ['version'] or @show_version
|
@@ -219,13 +218,18 @@ ERR
|
|
219
218
|
@navigate ||=Navigate.new(self, @navigation)
|
220
219
|
end
|
221
220
|
|
222
|
-
private
|
223
221
|
def parse_and_set_api_url(url, source)
|
224
222
|
begin
|
225
223
|
unless url.start_with?('http:') or url.start_with?('https:')
|
226
224
|
raise Razor::CLI::InvalidURIError.new(url, source)
|
227
225
|
end
|
228
226
|
@api_url = URI.parse(url)
|
227
|
+
|
228
|
+
# Localhost won't match the server's certificate; no verification required.
|
229
|
+
# This needs to happen after get_optparse so `-k` and `-u` can take effect.
|
230
|
+
if @api_url.hostname == 'localhost'
|
231
|
+
@verify_ssl = false
|
232
|
+
end
|
229
233
|
rescue URI::InvalidURIError => e
|
230
234
|
raise Razor::CLI::InvalidURIError.new(url, source)
|
231
235
|
end
|
data/lib/razor/cli/version.rb
CHANGED
@@ -18,7 +18,7 @@ module Razor
|
|
18
18
|
#
|
19
19
|
# The next line is the one that our packaging tools modify, so please make
|
20
20
|
# sure that any change to it is discussed and agreed first.
|
21
|
-
version = '1.
|
21
|
+
version = '1.8.1'
|
22
22
|
|
23
23
|
if version == "DEVELOPMENT"
|
24
24
|
root = File.expand_path("../../..", File.dirname(__FILE__))
|
data/spec/cli/command_spec.rb
CHANGED
@@ -71,7 +71,6 @@ describe Razor::CLI::Command do
|
|
71
71
|
c.extract_command
|
72
72
|
end
|
73
73
|
context "flag length" do
|
74
|
-
|
75
74
|
it "fails with a single dash for long flags" do
|
76
75
|
expect{extract({'schema' => {'name' => {'type' => 'array'}}}, ['-name', 'abc'])}.
|
77
76
|
to raise_error(ArgumentError, 'Unexpected argument -name (did you mean --name?)')
|
@@ -97,6 +96,16 @@ describe Razor::CLI::Command do
|
|
97
96
|
end
|
98
97
|
end
|
99
98
|
|
99
|
+
it "handles all reasonable characters" do
|
100
|
+
def generate_arg
|
101
|
+
prng = Random.new
|
102
|
+
[*'a'..'z'].shuffle(random: prng).first +
|
103
|
+
[*'a'..'z', '-', '_'].shuffle(random:prng).join
|
104
|
+
end
|
105
|
+
arg = generate_arg
|
106
|
+
extract({'schema' => {arg => {'type' => 'array'}}}, ["--#{arg}", 'abc'])[arg].should == ['abc']
|
107
|
+
end
|
108
|
+
|
100
109
|
context "positional arguments" do
|
101
110
|
let(:schema) do
|
102
111
|
{'schema' => {'n' => {'position' => 1},
|
data/spec/cli/navigate_spec.rb
CHANGED
@@ -24,7 +24,7 @@ describe Razor::CLI::Navigate do
|
|
24
24
|
it { nav.get_document['items'].should == []}
|
25
25
|
|
26
26
|
it do
|
27
|
-
nav.get_document
|
27
|
+
nav.get_document
|
28
28
|
nav.last_url.to_s.should =~ %r{/api/collections/tags$}
|
29
29
|
end
|
30
30
|
end
|
@@ -42,8 +42,8 @@ describe Razor::CLI::Navigate do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should fail with malformed argument" do
|
45
|
-
nav = Razor::CLI::Parse.new(['create-tag', '
|
46
|
-
expect{nav.get_document}.to raise_error(ArgumentError, /Unexpected argument --
|
45
|
+
nav = Razor::CLI::Parse.new(['create-tag', 'tag_2', 'rule', '--inva^lid']).navigate
|
46
|
+
expect{nav.get_document}.to raise_error(ArgumentError, /Unexpected argument --inva\^lid/)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -54,6 +54,52 @@ describe Razor::CLI::Navigate do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
context "finds the right API", :vcr do
|
58
|
+
def stub_results(real_url)
|
59
|
+
api_fixtures_path = File::join(File::dirname(__FILE__), '..', 'fixtures', 'sample_api')
|
60
|
+
sample_api = File.read(api_fixtures_path)
|
61
|
+
stub_const('Razor::CLI::Navigate::RAZOR_HTTPS_API', 'https://bad-https:8151/api')
|
62
|
+
stub_const('Razor::CLI::Navigate::RAZOR_HTTP_API', 'http://bad-http:8150/api')
|
63
|
+
::WebMock.stub_request(:get, real_url).to_return(body: sample_api, headers: {"Content-Type" => 'application/json'})
|
64
|
+
::WebMock.stub_request(:head, real_url)
|
65
|
+
end
|
66
|
+
let(:cli_string) do
|
67
|
+
%w[--version].freeze
|
68
|
+
end
|
69
|
+
it "chooses the -u argument first" do
|
70
|
+
url = 'http://u-argument:8000'
|
71
|
+
stub_results(url)
|
72
|
+
cli_string = %W[-u #{url} --version].freeze
|
73
|
+
nav = Razor::CLI::Parse.new(cli_string).navigate
|
74
|
+
nav.last_url.to_s.should == url
|
75
|
+
end
|
76
|
+
it "chooses the ENV variable second" do
|
77
|
+
url = 'http://env-variable:8000'
|
78
|
+
stub_results(url)
|
79
|
+
ENV::store('RAZOR_API', url)
|
80
|
+
nav = Razor::CLI::Parse.new(cli_string).navigate
|
81
|
+
nav.last_url.to_s.should == url
|
82
|
+
end
|
83
|
+
it "chooses the HTTPS URL third" do
|
84
|
+
url = 'http://https-url:8000'
|
85
|
+
stub_results(url)
|
86
|
+
stub_const('Razor::CLI::Navigate::RAZOR_HTTPS_API', url)
|
87
|
+
nav = Razor::CLI::Parse.new(cli_string).navigate
|
88
|
+
nav.last_url.to_s.should == url
|
89
|
+
end
|
90
|
+
it "chooses the HTTP URL last" do
|
91
|
+
url = 'http://http-url:8000'
|
92
|
+
refused = 'http://refused:404/api'
|
93
|
+
stub_results(url)
|
94
|
+
# PRIORITY still needs to be refused
|
95
|
+
stub_const('Razor::CLI::Navigate::RAZOR_HTTPS_API', refused)
|
96
|
+
::WebMock.stub_request(:head, refused).to_raise(Errno::ECONNREFUSED)
|
97
|
+
stub_const('Razor::CLI::Navigate::RAZOR_HTTP_API', url)
|
98
|
+
nav = Razor::CLI::Parse.new(cli_string).navigate
|
99
|
+
nav.last_url.to_s.should == url
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
57
103
|
context "with multiple arguments with same name", :vcr do
|
58
104
|
context "combining as an array" do
|
59
105
|
before(:each) do
|
@@ -238,7 +284,9 @@ describe Razor::CLI::Navigate do
|
|
238
284
|
nav.accept_language.should == GettextSetup.candidate_locales
|
239
285
|
end
|
240
286
|
it "should allow other accept-language headers" do
|
241
|
-
|
287
|
+
# This will be set on the client's machine. We're not concerned with how
|
288
|
+
# the Locale library figures this out.
|
289
|
+
Locale.set_current('de_DE')
|
242
290
|
locales = GettextSetup.candidate_locales
|
243
291
|
locales.should == 'de_DE,de,en'
|
244
292
|
nav = Razor::CLI::Parse.new(['create-broker', '--name=other-broker', '--broker-type', 'puppet-pe', '-c', 'server=abc.com']).navigate
|
data/spec/cli/parse_spec.rb
CHANGED
@@ -16,10 +16,9 @@ describe Razor::CLI::Parse do
|
|
16
16
|
Razor::CLI::Parse.new(args)
|
17
17
|
end
|
18
18
|
|
19
|
-
describe "#new" do
|
19
|
+
describe "#new", :vcr do
|
20
20
|
context "with no arguments" do
|
21
21
|
it {parse.show_help?.should be true}
|
22
|
-
it {parse.verify_ssl?.should be false}
|
23
22
|
end
|
24
23
|
|
25
24
|
context "with a '-h'" do
|
@@ -0,0 +1 @@
|
|
1
|
+
{"commands":[{"name":"add-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/add-policy-tag","id":"http://localhost:8150/api/commands/add-policy-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8150/api/commands/create-broker"},{"name":"create-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/create-hook","id":"http://localhost:8150/api/commands/create-hook"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8150/api/commands/create-policy"},{"name":"create-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/create-repo","id":"http://localhost:8150/api/commands/create-repo"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8150/api/commands/create-tag"},{"name":"create-task","rel":"http://api.puppetlabs.com/razor/v1/commands/create-task","id":"http://localhost:8150/api/commands/create-task"},{"name":"delete-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-broker","id":"http://localhost:8150/api/commands/delete-broker"},{"name":"delete-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-hook","id":"http://localhost:8150/api/commands/delete-hook"},{"name":"delete-node","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-node","id":"http://localhost:8150/api/commands/delete-node"},{"name":"delete-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-policy","id":"http://localhost:8150/api/commands/delete-policy"},{"name":"delete-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-repo","id":"http://localhost:8150/api/commands/delete-repo"},{"name":"delete-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-tag","id":"http://localhost:8150/api/commands/delete-tag"},{"name":"disable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/disable-policy","id":"http://localhost:8150/api/commands/disable-policy"},{"name":"enable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/enable-policy","id":"http://localhost:8150/api/commands/enable-policy"},{"name":"modify-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-node-metadata","id":"http://localhost:8150/api/commands/modify-node-metadata"},{"name":"modify-policy-max-count","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-policy-max-count","id":"http://localhost:8150/api/commands/modify-policy-max-count"},{"name":"move-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/move-policy","id":"http://localhost:8150/api/commands/move-policy"},{"name":"reboot-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reboot-node","id":"http://localhost:8150/api/commands/reboot-node"},{"name":"register-node","rel":"http://api.puppetlabs.com/razor/v1/commands/register-node","id":"http://localhost:8150/api/commands/register-node"},{"name":"reinstall-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reinstall-node","id":"http://localhost:8150/api/commands/reinstall-node"},{"name":"remove-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-node-metadata","id":"http://localhost:8150/api/commands/remove-node-metadata"},{"name":"remove-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-policy-tag","id":"http://localhost:8150/api/commands/remove-policy-tag"},{"name":"run-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/run-hook","id":"http://localhost:8150/api/commands/run-hook"},{"name":"set-node-desired-power-state","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-desired-power-state","id":"http://localhost:8150/api/commands/set-node-desired-power-state"},{"name":"set-node-hw-info","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-hw-info","id":"http://localhost:8150/api/commands/set-node-hw-info"},{"name":"set-node-ipmi-credentials","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-ipmi-credentials","id":"http://localhost:8150/api/commands/set-node-ipmi-credentials"},{"name":"update-broker-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-broker-configuration","id":"http://localhost:8150/api/commands/update-broker-configuration"},{"name":"update-hook-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-hook-configuration","id":"http://localhost:8150/api/commands/update-hook-configuration"},{"name":"update-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-node-metadata","id":"http://localhost:8150/api/commands/update-node-metadata"},{"name":"update-policy-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-broker","id":"http://localhost:8150/api/commands/update-policy-broker"},{"name":"update-policy-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-node-metadata","id":"http://localhost:8150/api/commands/update-policy-node-metadata"},{"name":"update-policy-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-repo","id":"http://localhost:8150/api/commands/update-policy-repo"},{"name":"update-policy-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-task","id":"http://localhost:8150/api/commands/update-policy-task"},{"name":"update-repo-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-repo-task","id":"http://localhost:8150/api/commands/update-repo-task"},{"name":"update-tag-rule","rel":"http://api.puppetlabs.com/razor/v1/commands/update-tag-rule","id":"http://localhost:8150/api/commands/update-tag-rule"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8150/api/collections/brokers"},{"name":"repos","rel":"http://api.puppetlabs.com/razor/v1/collections/repos","id":"http://localhost:8150/api/collections/repos"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8150/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8150/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8150/api/collections/nodes","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"tasks","rel":"http://api.puppetlabs.com/razor/v1/collections/tasks","id":"http://localhost:8150/api/collections/tasks"},{"name":"commands","rel":"http://api.puppetlabs.com/razor/v1/collections/commands","id":"http://localhost:8150/api/collections/commands"},{"name":"events","rel":"http://api.puppetlabs.com/razor/v1/collections/events","id":"http://localhost:8150/api/collections/events","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"hooks","rel":"http://api.puppetlabs.com/razor/v1/collections/hooks","id":"http://localhost:8150/api/collections/hooks"},{"name":"config","rel":"http://api.puppetlabs.com/razor/v1/collections/config","id":"http://localhost:8150/api/collections/config"}],"version":{"server":"not-a-real-version"}}
|
@@ -11,10 +11,12 @@ http_interactions:
|
|
11
11
|
- application/json
|
12
12
|
Accept-Encoding:
|
13
13
|
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- rest-client/2.0.2 (darwin x86_64) jruby/9.1.5.0 (2.3.1p0)
|
14
16
|
Accept-Language:
|
15
17
|
- de_DE,de,en
|
16
|
-
|
17
|
-
-
|
18
|
+
Host:
|
19
|
+
- localhost:8150
|
18
20
|
response:
|
19
21
|
status:
|
20
22
|
code: 200
|
@@ -27,12 +29,12 @@ http_interactions:
|
|
27
29
|
Content-Type:
|
28
30
|
- application/json
|
29
31
|
Content-Length:
|
30
|
-
- '
|
32
|
+
- '7110'
|
31
33
|
Date:
|
32
|
-
-
|
34
|
+
- Mon, 23 Apr 2018 19:49:49 GMT
|
33
35
|
body:
|
34
|
-
encoding:
|
35
|
-
string: '{"commands":[{"name":"add-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/add-policy-tag","id":"http://localhost:8150/api/commands/add-policy-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8150/api/commands/create-broker"},{"name":"create-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/create-hook","id":"http://localhost:8150/api/commands/create-hook"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8150/api/commands/create-policy"},{"name":"create-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/create-repo","id":"http://localhost:8150/api/commands/create-repo"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8150/api/commands/create-tag"},{"name":"create-task","rel":"http://api.puppetlabs.com/razor/v1/commands/create-task","id":"http://localhost:8150/api/commands/create-task"},{"name":"delete-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-broker","id":"http://localhost:8150/api/commands/delete-broker"},{"name":"delete-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-hook","id":"http://localhost:8150/api/commands/delete-hook"},{"name":"delete-node","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-node","id":"http://localhost:8150/api/commands/delete-node"},{"name":"delete-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-policy","id":"http://localhost:8150/api/commands/delete-policy"},{"name":"delete-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-repo","id":"http://localhost:8150/api/commands/delete-repo"},{"name":"delete-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-tag","id":"http://localhost:8150/api/commands/delete-tag"},{"name":"disable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/disable-policy","id":"http://localhost:8150/api/commands/disable-policy"},{"name":"enable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/enable-policy","id":"http://localhost:8150/api/commands/enable-policy"},{"name":"modify-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-node-metadata","id":"http://localhost:8150/api/commands/modify-node-metadata"},{"name":"modify-policy-max-count","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-policy-max-count","id":"http://localhost:8150/api/commands/modify-policy-max-count"},{"name":"move-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/move-policy","id":"http://localhost:8150/api/commands/move-policy"},{"name":"reboot-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reboot-node","id":"http://localhost:8150/api/commands/reboot-node"},{"name":"register-node","rel":"http://api.puppetlabs.com/razor/v1/commands/register-node","id":"http://localhost:8150/api/commands/register-node"},{"name":"reinstall-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reinstall-node","id":"http://localhost:8150/api/commands/reinstall-node"},{"name":"remove-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-node-metadata","id":"http://localhost:8150/api/commands/remove-node-metadata"},{"name":"remove-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-policy-tag","id":"http://localhost:8150/api/commands/remove-policy-tag"},{"name":"run-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/run-hook","id":"http://localhost:8150/api/commands/run-hook"},{"name":"set-node-desired-power-state","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-desired-power-state","id":"http://localhost:8150/api/commands/set-node-desired-power-state"},{"name":"set-node-hw-info","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-hw-info","id":"http://localhost:8150/api/commands/set-node-hw-info"},{"name":"set-node-ipmi-credentials","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-ipmi-credentials","id":"http://localhost:8150/api/commands/set-node-ipmi-credentials"},{"name":"update-broker-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-broker-configuration","id":"http://localhost:8150/api/commands/update-broker-configuration"},{"name":"update-hook-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-hook-configuration","id":"http://localhost:8150/api/commands/update-hook-configuration"},{"name":"update-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-node-metadata","id":"http://localhost:8150/api/commands/update-node-metadata"},{"name":"update-policy-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-broker","id":"http://localhost:8150/api/commands/update-policy-broker"},{"name":"update-policy-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-node-metadata","id":"http://localhost:8150/api/commands/update-policy-node-metadata"},{"name":"update-policy-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-repo","id":"http://localhost:8150/api/commands/update-policy-repo"},{"name":"update-policy-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-task","id":"http://localhost:8150/api/commands/update-policy-task"},{"name":"update-repo-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-repo-task","id":"http://localhost:8150/api/commands/update-repo-task"},{"name":"update-tag-rule","rel":"http://api.puppetlabs.com/razor/v1/commands/update-tag-rule","id":"http://localhost:8150/api/commands/update-tag-rule"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8150/api/collections/brokers"},{"name":"repos","rel":"http://api.puppetlabs.com/razor/v1/collections/repos","id":"http://localhost:8150/api/collections/repos"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8150/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8150/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8150/api/collections/nodes","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"tasks","rel":"http://api.puppetlabs.com/razor/v1/collections/tasks","id":"http://localhost:8150/api/collections/tasks"},{"name":"commands","rel":"http://api.puppetlabs.com/razor/v1/collections/commands","id":"http://localhost:8150/api/collections/commands"},{"name":"events","rel":"http://api.puppetlabs.com/razor/v1/collections/events","id":"http://localhost:8150/api/collections/events","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"hooks","rel":"http://api.puppetlabs.com/razor/v1/collections/hooks","id":"http://localhost:8150/api/collections/hooks"},{"name":"config","rel":"http://api.puppetlabs.com/razor/v1/collections/config","id":"http://localhost:8150/api/collections/config"}],"version":{"server":"v1.
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"commands":[{"name":"add-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/add-policy-tag","id":"http://localhost:8150/api/commands/add-policy-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8150/api/commands/create-broker"},{"name":"create-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/create-hook","id":"http://localhost:8150/api/commands/create-hook"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8150/api/commands/create-policy"},{"name":"create-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/create-repo","id":"http://localhost:8150/api/commands/create-repo"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8150/api/commands/create-tag"},{"name":"create-task","rel":"http://api.puppetlabs.com/razor/v1/commands/create-task","id":"http://localhost:8150/api/commands/create-task"},{"name":"delete-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-broker","id":"http://localhost:8150/api/commands/delete-broker"},{"name":"delete-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-hook","id":"http://localhost:8150/api/commands/delete-hook"},{"name":"delete-node","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-node","id":"http://localhost:8150/api/commands/delete-node"},{"name":"delete-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-policy","id":"http://localhost:8150/api/commands/delete-policy"},{"name":"delete-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-repo","id":"http://localhost:8150/api/commands/delete-repo"},{"name":"delete-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-tag","id":"http://localhost:8150/api/commands/delete-tag"},{"name":"disable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/disable-policy","id":"http://localhost:8150/api/commands/disable-policy"},{"name":"enable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/enable-policy","id":"http://localhost:8150/api/commands/enable-policy"},{"name":"modify-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-node-metadata","id":"http://localhost:8150/api/commands/modify-node-metadata"},{"name":"modify-policy-max-count","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-policy-max-count","id":"http://localhost:8150/api/commands/modify-policy-max-count"},{"name":"move-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/move-policy","id":"http://localhost:8150/api/commands/move-policy"},{"name":"reboot-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reboot-node","id":"http://localhost:8150/api/commands/reboot-node"},{"name":"register-node","rel":"http://api.puppetlabs.com/razor/v1/commands/register-node","id":"http://localhost:8150/api/commands/register-node"},{"name":"reinstall-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reinstall-node","id":"http://localhost:8150/api/commands/reinstall-node"},{"name":"remove-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-node-metadata","id":"http://localhost:8150/api/commands/remove-node-metadata"},{"name":"remove-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-policy-tag","id":"http://localhost:8150/api/commands/remove-policy-tag"},{"name":"run-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/run-hook","id":"http://localhost:8150/api/commands/run-hook"},{"name":"set-node-desired-power-state","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-desired-power-state","id":"http://localhost:8150/api/commands/set-node-desired-power-state"},{"name":"set-node-hw-info","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-hw-info","id":"http://localhost:8150/api/commands/set-node-hw-info"},{"name":"set-node-ipmi-credentials","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-ipmi-credentials","id":"http://localhost:8150/api/commands/set-node-ipmi-credentials"},{"name":"update-broker-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-broker-configuration","id":"http://localhost:8150/api/commands/update-broker-configuration"},{"name":"update-hook-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-hook-configuration","id":"http://localhost:8150/api/commands/update-hook-configuration"},{"name":"update-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-node-metadata","id":"http://localhost:8150/api/commands/update-node-metadata"},{"name":"update-policy-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-broker","id":"http://localhost:8150/api/commands/update-policy-broker"},{"name":"update-policy-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-node-metadata","id":"http://localhost:8150/api/commands/update-policy-node-metadata"},{"name":"update-policy-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-repo","id":"http://localhost:8150/api/commands/update-policy-repo"},{"name":"update-policy-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-task","id":"http://localhost:8150/api/commands/update-policy-task"},{"name":"update-repo-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-repo-task","id":"http://localhost:8150/api/commands/update-repo-task"},{"name":"update-tag-rule","rel":"http://api.puppetlabs.com/razor/v1/commands/update-tag-rule","id":"http://localhost:8150/api/commands/update-tag-rule"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8150/api/collections/brokers"},{"name":"repos","rel":"http://api.puppetlabs.com/razor/v1/collections/repos","id":"http://localhost:8150/api/collections/repos"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8150/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8150/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8150/api/collections/nodes","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"tasks","rel":"http://api.puppetlabs.com/razor/v1/collections/tasks","id":"http://localhost:8150/api/collections/tasks"},{"name":"commands","rel":"http://api.puppetlabs.com/razor/v1/collections/commands","id":"http://localhost:8150/api/collections/commands"},{"name":"events","rel":"http://api.puppetlabs.com/razor/v1/collections/events","id":"http://localhost:8150/api/collections/events","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"hooks","rel":"http://api.puppetlabs.com/razor/v1/collections/hooks","id":"http://localhost:8150/api/collections/hooks"},{"name":"config","rel":"http://api.puppetlabs.com/razor/v1/collections/config","id":"http://localhost:8150/api/collections/config"}],"version":{"server":"v1.8.0-dirty"}}'
|
36
38
|
http_version:
|
37
|
-
recorded_at:
|
38
|
-
recorded_with: VCR
|
39
|
+
recorded_at: Mon, 23 Apr 2018 19:49:49 GMT
|
40
|
+
recorded_with: VCR 4.0.0
|
@@ -11,10 +11,12 @@ http_interactions:
|
|
11
11
|
- application/json
|
12
12
|
Accept-Encoding:
|
13
13
|
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- rest-client/2.0.2 (darwin x86_64) jruby/9.1.5.0 (2.3.1p0)
|
14
16
|
Accept-Language:
|
15
17
|
- en_US,en
|
16
|
-
|
17
|
-
-
|
18
|
+
Host:
|
19
|
+
- localhost:8150
|
18
20
|
response:
|
19
21
|
status:
|
20
22
|
code: 200
|
@@ -27,12 +29,12 @@ http_interactions:
|
|
27
29
|
Content-Type:
|
28
30
|
- application/json
|
29
31
|
Content-Length:
|
30
|
-
- '
|
32
|
+
- '7110'
|
31
33
|
Date:
|
32
|
-
-
|
34
|
+
- Mon, 23 Apr 2018 19:49:43 GMT
|
33
35
|
body:
|
34
|
-
encoding:
|
35
|
-
string: '{"commands":[{"name":"add-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/add-policy-tag","id":"http://localhost:8150/api/commands/add-policy-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8150/api/commands/create-broker"},{"name":"create-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/create-hook","id":"http://localhost:8150/api/commands/create-hook"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8150/api/commands/create-policy"},{"name":"create-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/create-repo","id":"http://localhost:8150/api/commands/create-repo"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8150/api/commands/create-tag"},{"name":"create-task","rel":"http://api.puppetlabs.com/razor/v1/commands/create-task","id":"http://localhost:8150/api/commands/create-task"},{"name":"delete-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-broker","id":"http://localhost:8150/api/commands/delete-broker"},{"name":"delete-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-hook","id":"http://localhost:8150/api/commands/delete-hook"},{"name":"delete-node","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-node","id":"http://localhost:8150/api/commands/delete-node"},{"name":"delete-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-policy","id":"http://localhost:8150/api/commands/delete-policy"},{"name":"delete-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-repo","id":"http://localhost:8150/api/commands/delete-repo"},{"name":"delete-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-tag","id":"http://localhost:8150/api/commands/delete-tag"},{"name":"disable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/disable-policy","id":"http://localhost:8150/api/commands/disable-policy"},{"name":"enable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/enable-policy","id":"http://localhost:8150/api/commands/enable-policy"},{"name":"modify-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-node-metadata","id":"http://localhost:8150/api/commands/modify-node-metadata"},{"name":"modify-policy-max-count","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-policy-max-count","id":"http://localhost:8150/api/commands/modify-policy-max-count"},{"name":"move-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/move-policy","id":"http://localhost:8150/api/commands/move-policy"},{"name":"reboot-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reboot-node","id":"http://localhost:8150/api/commands/reboot-node"},{"name":"register-node","rel":"http://api.puppetlabs.com/razor/v1/commands/register-node","id":"http://localhost:8150/api/commands/register-node"},{"name":"reinstall-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reinstall-node","id":"http://localhost:8150/api/commands/reinstall-node"},{"name":"remove-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-node-metadata","id":"http://localhost:8150/api/commands/remove-node-metadata"},{"name":"remove-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-policy-tag","id":"http://localhost:8150/api/commands/remove-policy-tag"},{"name":"run-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/run-hook","id":"http://localhost:8150/api/commands/run-hook"},{"name":"set-node-desired-power-state","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-desired-power-state","id":"http://localhost:8150/api/commands/set-node-desired-power-state"},{"name":"set-node-hw-info","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-hw-info","id":"http://localhost:8150/api/commands/set-node-hw-info"},{"name":"set-node-ipmi-credentials","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-ipmi-credentials","id":"http://localhost:8150/api/commands/set-node-ipmi-credentials"},{"name":"update-broker-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-broker-configuration","id":"http://localhost:8150/api/commands/update-broker-configuration"},{"name":"update-hook-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-hook-configuration","id":"http://localhost:8150/api/commands/update-hook-configuration"},{"name":"update-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-node-metadata","id":"http://localhost:8150/api/commands/update-node-metadata"},{"name":"update-policy-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-broker","id":"http://localhost:8150/api/commands/update-policy-broker"},{"name":"update-policy-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-node-metadata","id":"http://localhost:8150/api/commands/update-policy-node-metadata"},{"name":"update-policy-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-repo","id":"http://localhost:8150/api/commands/update-policy-repo"},{"name":"update-policy-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-task","id":"http://localhost:8150/api/commands/update-policy-task"},{"name":"update-repo-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-repo-task","id":"http://localhost:8150/api/commands/update-repo-task"},{"name":"update-tag-rule","rel":"http://api.puppetlabs.com/razor/v1/commands/update-tag-rule","id":"http://localhost:8150/api/commands/update-tag-rule"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8150/api/collections/brokers"},{"name":"repos","rel":"http://api.puppetlabs.com/razor/v1/collections/repos","id":"http://localhost:8150/api/collections/repos"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8150/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8150/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8150/api/collections/nodes","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"tasks","rel":"http://api.puppetlabs.com/razor/v1/collections/tasks","id":"http://localhost:8150/api/collections/tasks"},{"name":"commands","rel":"http://api.puppetlabs.com/razor/v1/collections/commands","id":"http://localhost:8150/api/collections/commands"},{"name":"events","rel":"http://api.puppetlabs.com/razor/v1/collections/events","id":"http://localhost:8150/api/collections/events","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"hooks","rel":"http://api.puppetlabs.com/razor/v1/collections/hooks","id":"http://localhost:8150/api/collections/hooks"},{"name":"config","rel":"http://api.puppetlabs.com/razor/v1/collections/config","id":"http://localhost:8150/api/collections/config"}],"version":{"server":"v1.
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"commands":[{"name":"add-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/add-policy-tag","id":"http://localhost:8150/api/commands/add-policy-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8150/api/commands/create-broker"},{"name":"create-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/create-hook","id":"http://localhost:8150/api/commands/create-hook"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8150/api/commands/create-policy"},{"name":"create-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/create-repo","id":"http://localhost:8150/api/commands/create-repo"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8150/api/commands/create-tag"},{"name":"create-task","rel":"http://api.puppetlabs.com/razor/v1/commands/create-task","id":"http://localhost:8150/api/commands/create-task"},{"name":"delete-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-broker","id":"http://localhost:8150/api/commands/delete-broker"},{"name":"delete-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-hook","id":"http://localhost:8150/api/commands/delete-hook"},{"name":"delete-node","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-node","id":"http://localhost:8150/api/commands/delete-node"},{"name":"delete-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-policy","id":"http://localhost:8150/api/commands/delete-policy"},{"name":"delete-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-repo","id":"http://localhost:8150/api/commands/delete-repo"},{"name":"delete-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-tag","id":"http://localhost:8150/api/commands/delete-tag"},{"name":"disable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/disable-policy","id":"http://localhost:8150/api/commands/disable-policy"},{"name":"enable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/enable-policy","id":"http://localhost:8150/api/commands/enable-policy"},{"name":"modify-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-node-metadata","id":"http://localhost:8150/api/commands/modify-node-metadata"},{"name":"modify-policy-max-count","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-policy-max-count","id":"http://localhost:8150/api/commands/modify-policy-max-count"},{"name":"move-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/move-policy","id":"http://localhost:8150/api/commands/move-policy"},{"name":"reboot-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reboot-node","id":"http://localhost:8150/api/commands/reboot-node"},{"name":"register-node","rel":"http://api.puppetlabs.com/razor/v1/commands/register-node","id":"http://localhost:8150/api/commands/register-node"},{"name":"reinstall-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reinstall-node","id":"http://localhost:8150/api/commands/reinstall-node"},{"name":"remove-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-node-metadata","id":"http://localhost:8150/api/commands/remove-node-metadata"},{"name":"remove-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-policy-tag","id":"http://localhost:8150/api/commands/remove-policy-tag"},{"name":"run-hook","rel":"http://api.puppetlabs.com/razor/v1/commands/run-hook","id":"http://localhost:8150/api/commands/run-hook"},{"name":"set-node-desired-power-state","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-desired-power-state","id":"http://localhost:8150/api/commands/set-node-desired-power-state"},{"name":"set-node-hw-info","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-hw-info","id":"http://localhost:8150/api/commands/set-node-hw-info"},{"name":"set-node-ipmi-credentials","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-ipmi-credentials","id":"http://localhost:8150/api/commands/set-node-ipmi-credentials"},{"name":"update-broker-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-broker-configuration","id":"http://localhost:8150/api/commands/update-broker-configuration"},{"name":"update-hook-configuration","rel":"http://api.puppetlabs.com/razor/v1/commands/update-hook-configuration","id":"http://localhost:8150/api/commands/update-hook-configuration"},{"name":"update-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-node-metadata","id":"http://localhost:8150/api/commands/update-node-metadata"},{"name":"update-policy-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-broker","id":"http://localhost:8150/api/commands/update-policy-broker"},{"name":"update-policy-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-node-metadata","id":"http://localhost:8150/api/commands/update-policy-node-metadata"},{"name":"update-policy-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-repo","id":"http://localhost:8150/api/commands/update-policy-repo"},{"name":"update-policy-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-policy-task","id":"http://localhost:8150/api/commands/update-policy-task"},{"name":"update-repo-task","rel":"http://api.puppetlabs.com/razor/v1/commands/update-repo-task","id":"http://localhost:8150/api/commands/update-repo-task"},{"name":"update-tag-rule","rel":"http://api.puppetlabs.com/razor/v1/commands/update-tag-rule","id":"http://localhost:8150/api/commands/update-tag-rule"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8150/api/collections/brokers"},{"name":"repos","rel":"http://api.puppetlabs.com/razor/v1/collections/repos","id":"http://localhost:8150/api/collections/repos"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8150/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8150/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8150/api/collections/nodes","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"tasks","rel":"http://api.puppetlabs.com/razor/v1/collections/tasks","id":"http://localhost:8150/api/collections/tasks"},{"name":"commands","rel":"http://api.puppetlabs.com/razor/v1/collections/commands","id":"http://localhost:8150/api/collections/commands"},{"name":"events","rel":"http://api.puppetlabs.com/razor/v1/collections/events","id":"http://localhost:8150/api/collections/events","params":{"start":{"type":"number"},"limit":{"type":"number"}}},{"name":"hooks","rel":"http://api.puppetlabs.com/razor/v1/collections/hooks","id":"http://localhost:8150/api/collections/hooks"},{"name":"config","rel":"http://api.puppetlabs.com/razor/v1/collections/config","id":"http://localhost:8150/api/collections/config"}],"version":{"server":"v1.8.0-dirty"}}'
|
36
38
|
http_version:
|
37
|
-
recorded_at:
|
38
|
-
recorded_with: VCR
|
39
|
+
recorded_at: Mon, 23 Apr 2018 19:49:43 GMT
|
40
|
+
recorded_with: VCR 4.0.0
|