razor-client 0.15.1 → 0.16.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.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/NEWS.md +22 -0
  3. data/bin/razor +24 -0
  4. data/lib/razor/cli/command.rb +139 -0
  5. data/lib/razor/cli/document.rb +8 -4
  6. data/lib/razor/cli/format.rb +46 -22
  7. data/lib/razor/cli/navigate.rb +27 -149
  8. data/lib/razor/cli/parse.rb +21 -5
  9. data/lib/razor/cli/query.rb +68 -0
  10. data/lib/razor/cli/table_format.rb +41 -0
  11. data/lib/razor/cli/transforms.rb +18 -0
  12. data/lib/razor/cli/version.rb +1 -1
  13. data/lib/razor/cli/views.yaml +38 -0
  14. data/lib/razor/cli.rb +5 -2
  15. data/spec/cli/format_spec.rb +95 -5
  16. data/spec/cli/navigate_spec.rb +49 -5
  17. data/spec/cli/parse_spec.rb +21 -0
  18. data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_in_string.yml +322 -0
  19. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_API_command_help_for_razor_--api_command_--help_.yml +110 -0
  20. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_API_command_help_for_razor_--api_command_help_.yml +110 -0
  21. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_API_command_help_for_razor_--api_help_command_.yml +110 -0
  22. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_API_command_help_for_razor_--help_--api_command_.yml +110 -0
  23. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_API_command_help_for_razor_-a_-h_command_.yml +110 -0
  24. data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_API_command_help_for_razor_-a_command_-h_.yml +110 -0
  25. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_construct_a_json_object.yml +181 -49
  26. 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 +121 -46
  27. 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 +68 -65
  28. 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 +177 -45
  29. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_append_limit.yml +69 -0
  30. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_append_start.yml +69 -0
  31. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_not_fail_when_query_returns_details_for_one_item.yml +421 -0
  32. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_store_query_without_query_parameters.yml +773 -0
  33. data/spec/fixtures/vcr/Razor_CLI_Navigate/with_query_parameters/should_throw_an_error_if_the_query_parameter_is_not_in_the_API.yml +36 -0
  34. 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 +388 -0
  35. metadata +94 -82
@@ -19,6 +19,7 @@ describe Razor::CLI::Parse do
19
19
  describe "#new" do
20
20
  context "with no arguments" do
21
21
  it {parse.show_help?.should be true}
22
+ it {parse.verify_ssl?.should be true}
22
23
  end
23
24
 
24
25
  context "with a '-h'" do
@@ -58,6 +59,26 @@ describe Razor::CLI::Parse do
58
59
  it "should terminate with an error if an invalid URL is provided" do
59
60
  expect{parse('-u','not valid url')}.to raise_error(Razor::CLI::InvalidURIError)
60
61
  end
62
+
63
+ it "should terminate with an error if a URL without a protocol is provided" do
64
+ expect{parse('-u','localhost:8080/api')}.to raise_error(Razor::CLI::InvalidURIError)
65
+ end
66
+ end
67
+
68
+ context "with a '-k'" do
69
+ it {parse("-k").verify_ssl?.should be false}
70
+ end
71
+
72
+ context "with an '-a'" do
73
+ it {parse("-a").show_api_help?.should be true}
74
+ end
75
+
76
+ context "with an '--api'" do
77
+ it {parse("--api").show_api_help?.should be true}
78
+ end
79
+
80
+ context "with a '--insecure'" do
81
+ it {parse("--insecure").verify_ssl?.should be false}
61
82
  end
62
83
 
63
84
  context "with ENV RAZOR_API set" do
@@ -0,0 +1,322 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8080/api
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ Content-Type:
26
+ - application/json;charset=utf-8
27
+ Content-Length:
28
+ - '4981'
29
+ Date:
30
+ - Thu, 14 Aug 2014 21:10:25 GMT
31
+ body:
32
+ encoding: US-ASCII
33
+ string: '{"commands":[{"name":"add-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/add-policy-tag","id":"http://localhost:8080/api/commands/add-policy-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8080/api/commands/create-broker"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8080/api/commands/create-policy"},{"name":"create-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/create-repo","id":"http://localhost:8080/api/commands/create-repo"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8080/api/commands/create-tag"},{"name":"create-task","rel":"http://api.puppetlabs.com/razor/v1/commands/create-task","id":"http://localhost:8080/api/commands/create-task"},{"name":"delete-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-broker","id":"http://localhost:8080/api/commands/delete-broker"},{"name":"delete-node","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-node","id":"http://localhost:8080/api/commands/delete-node"},{"name":"delete-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-policy","id":"http://localhost:8080/api/commands/delete-policy"},{"name":"delete-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-repo","id":"http://localhost:8080/api/commands/delete-repo"},{"name":"delete-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-tag","id":"http://localhost:8080/api/commands/delete-tag"},{"name":"disable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/disable-policy","id":"http://localhost:8080/api/commands/disable-policy"},{"name":"enable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/enable-policy","id":"http://localhost:8080/api/commands/enable-policy"},{"name":"modify-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-node-metadata","id":"http://localhost:8080/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:8080/api/commands/modify-policy-max-count"},{"name":"move-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/move-policy","id":"http://localhost:8080/api/commands/move-policy"},{"name":"reboot-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reboot-node","id":"http://localhost:8080/api/commands/reboot-node"},{"name":"register-node","rel":"http://api.puppetlabs.com/razor/v1/commands/register-node","id":"http://localhost:8080/api/commands/register-node"},{"name":"reinstall-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reinstall-node","id":"http://localhost:8080/api/commands/reinstall-node"},{"name":"remove-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-node-metadata","id":"http://localhost:8080/api/commands/remove-node-metadata"},{"name":"remove-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-policy-tag","id":"http://localhost:8080/api/commands/remove-policy-tag"},{"name":"set-node-desired-power-state","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-desired-power-state","id":"http://localhost:8080/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:8080/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:8080/api/commands/set-node-ipmi-credentials"},{"name":"update-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-node-metadata","id":"http://localhost:8080/api/commands/update-node-metadata"},{"name":"update-tag-rule","rel":"http://api.puppetlabs.com/razor/v1/commands/update-tag-rule","id":"http://localhost:8080/api/commands/update-tag-rule"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8080/api/collections/brokers"},{"name":"repos","rel":"http://api.puppetlabs.com/razor/v1/collections/repos","id":"http://localhost:8080/api/collections/repos"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8080/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8080/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8080/api/collections/nodes"},{"name":"tasks","rel":"http://api.puppetlabs.com/razor/v1/collections/tasks","id":"http://localhost:8080/api/collections/tasks"},{"name":"commands","rel":"http://api.puppetlabs.com/razor/v1/collections/commands","id":"http://localhost:8080/api/collections/commands"}],"version":{"server":"v0.15.0-26-gfffaba4-dirty"}}'
34
+ http_version:
35
+ recorded_at: Thu, 14 Aug 2014 21:10:25 GMT
36
+ - request:
37
+ method: get
38
+ uri: http://localhost:8080/api/commands/create-repo
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ''
42
+ headers:
43
+ Accept:
44
+ - application/json
45
+ Accept-Encoding:
46
+ - gzip, deflate
47
+ User-Agent:
48
+ - Ruby
49
+ response:
50
+ status:
51
+ code: 200
52
+ message: OK
53
+ headers:
54
+ Server:
55
+ - Apache-Coyote/1.1
56
+ Etag:
57
+ - '"server-version-v0.15.0-26-gfffaba4-dirty"'
58
+ X-Content-Type-Options:
59
+ - nosniff
60
+ Content-Type:
61
+ - application/json;charset=utf-8
62
+ Content-Length:
63
+ - '3240'
64
+ Date:
65
+ - Thu, 14 Aug 2014 21:10:25 GMT
66
+ body:
67
+ encoding: US-ASCII
68
+ string: '{"name":"create-repo","help":{"full":"# SYNOPSIS\nCreate a new repository,
69
+ from an ISO image or a URL\n\n# DESCRIPTION\nCreate a new repository, which
70
+ can either contain the content to install a\nnode, or simply point to an existing
71
+ online repository by URL.\n\n# Access Control\n\nThis command''s access control
72
+ pattern: `commands:create-repo:%{name}`\n\nWords surrounded by `%{...}` are
73
+ substitutions from the input data: typically\nthe name of the object being
74
+ modified, or some other critical detail, these\nallow roles to be granted
75
+ partial access to modify the system.\n\nFor more detail on how the permission
76
+ strings are structured and work, you can\nsee the [Shiro Permissions documentation][shiro]. That
77
+ pattern is expanded\nand then a permission check applied to it, before the
78
+ command is authorized.\n\nThese checks only apply if security is enabled in
79
+ the Razor configuration\nfile; on this server security is currently disabled.\n\n[shiro]:
80
+ http://shiro.apache.org/permissions.html\n\n# Attributes\n\n * name\n -
81
+ The name of the repository.\n - This attribute is required.\n - It must
82
+ be of type string.\n - It must be between 1 and 250 in length.\n\n * url\n -
83
+ The URL of the remote repository to use.\n - It must be of type string.\n -
84
+ If present, iso-url must not be present.\n - It must be between 1 and 1000
85
+ in length.\n\n * iso-url\n - The URL of the ISO image to download and unpack
86
+ to create the\n repository. This can be an HTTP or HTTPS URL, or it can
87
+ be a\n file URL.\n \n In the latter case, the file path is interpreted
88
+ as a path on the\n Razor server, rather than a path on the client. This
89
+ requires that\n you manually place the ISO image on the server before
90
+ invoking the\n command.\n - It must be of type string.\n - If present,
91
+ url must not be present.\n - It must be between 1 and 1000 in length.\n\n
92
+ * task\n - The name of the task associated with this repository. This is
93
+ used to\n install nodes that match a policy using this repository; generally
94
+ it\n should match the OS that the URL or ISO-URL attributes point to.\n -
95
+ This attribute is required.\n - It must be of type string.\n\n# EXAMPLES\n\n Create
96
+ a repository from an ISO image, which will be downloaded and unpacked\n by
97
+ the razor-server in the background:\n \n {\n \"name\": \"fedora19\",\n \"iso-url\":
98
+ \"http://example.com/Fedora-19-x86_64-DVD.iso\"\n \"task\": \"fedora\"\n }\n \n You
99
+ can also unpack an ISO image from a file *on the server*; this does not\n upload
100
+ the file from the client:\n {\n \"name\": \"fedora19\",\n \"iso-url\":
101
+ \"file:///tmp/Fedora-19-x86_64-DVD.iso\"\n \"task\": \"fedora\"\n }\n \n Finally,
102
+ you can provide a `url` property when you create the repository;\n this form
103
+ is merely a pointer to a resource somewhere and nothing will be\n downloaded
104
+ onto the Razor server:\n \n {\n \"name\": \"fedora19\",\n \"url\": \"http://mirrors.n-ix.net/fedora/linux/releases/19/Fedora/x86_64/os/\"\n \"task\":
105
+ \"fedora\"\n }\n"},"schema":{"name":{"type":"string"},"url":{"type":"string"},"iso-url":{"type":"string"},"task":{"type":"string"}}}'
106
+ http_version:
107
+ recorded_at: Thu, 14 Aug 2014 21:10:25 GMT
108
+ - request:
109
+ method: get
110
+ uri: http://localhost:8080/api/commands/create-repo
111
+ body:
112
+ encoding: US-ASCII
113
+ string: ''
114
+ headers:
115
+ Accept:
116
+ - application/json
117
+ Accept-Encoding:
118
+ - gzip, deflate
119
+ User-Agent:
120
+ - Ruby
121
+ response:
122
+ status:
123
+ code: 200
124
+ message: OK
125
+ headers:
126
+ Server:
127
+ - Apache-Coyote/1.1
128
+ Etag:
129
+ - '"server-version-v0.15.0-26-gfffaba4-dirty"'
130
+ X-Content-Type-Options:
131
+ - nosniff
132
+ Content-Type:
133
+ - application/json;charset=utf-8
134
+ Content-Length:
135
+ - '3240'
136
+ Date:
137
+ - Thu, 14 Aug 2014 21:10:25 GMT
138
+ body:
139
+ encoding: US-ASCII
140
+ string: '{"name":"create-repo","help":{"full":"# SYNOPSIS\nCreate a new repository,
141
+ from an ISO image or a URL\n\n# DESCRIPTION\nCreate a new repository, which
142
+ can either contain the content to install a\nnode, or simply point to an existing
143
+ online repository by URL.\n\n# Access Control\n\nThis command''s access control
144
+ pattern: `commands:create-repo:%{name}`\n\nWords surrounded by `%{...}` are
145
+ substitutions from the input data: typically\nthe name of the object being
146
+ modified, or some other critical detail, these\nallow roles to be granted
147
+ partial access to modify the system.\n\nFor more detail on how the permission
148
+ strings are structured and work, you can\nsee the [Shiro Permissions documentation][shiro]. That
149
+ pattern is expanded\nand then a permission check applied to it, before the
150
+ command is authorized.\n\nThese checks only apply if security is enabled in
151
+ the Razor configuration\nfile; on this server security is currently disabled.\n\n[shiro]:
152
+ http://shiro.apache.org/permissions.html\n\n# Attributes\n\n * name\n -
153
+ The name of the repository.\n - This attribute is required.\n - It must
154
+ be of type string.\n - It must be between 1 and 250 in length.\n\n * url\n -
155
+ The URL of the remote repository to use.\n - It must be of type string.\n -
156
+ If present, iso-url must not be present.\n - It must be between 1 and 1000
157
+ in length.\n\n * iso-url\n - The URL of the ISO image to download and unpack
158
+ to create the\n repository. This can be an HTTP or HTTPS URL, or it can
159
+ be a\n file URL.\n \n In the latter case, the file path is interpreted
160
+ as a path on the\n Razor server, rather than a path on the client. This
161
+ requires that\n you manually place the ISO image on the server before
162
+ invoking the\n command.\n - It must be of type string.\n - If present,
163
+ url must not be present.\n - It must be between 1 and 1000 in length.\n\n
164
+ * task\n - The name of the task associated with this repository. This is
165
+ used to\n install nodes that match a policy using this repository; generally
166
+ it\n should match the OS that the URL or ISO-URL attributes point to.\n -
167
+ This attribute is required.\n - It must be of type string.\n\n# EXAMPLES\n\n Create
168
+ a repository from an ISO image, which will be downloaded and unpacked\n by
169
+ the razor-server in the background:\n \n {\n \"name\": \"fedora19\",\n \"iso-url\":
170
+ \"http://example.com/Fedora-19-x86_64-DVD.iso\"\n \"task\": \"fedora\"\n }\n \n You
171
+ can also unpack an ISO image from a file *on the server*; this does not\n upload
172
+ the file from the client:\n {\n \"name\": \"fedora19\",\n \"iso-url\":
173
+ \"file:///tmp/Fedora-19-x86_64-DVD.iso\"\n \"task\": \"fedora\"\n }\n \n Finally,
174
+ you can provide a `url` property when you create the repository;\n this form
175
+ is merely a pointer to a resource somewhere and nothing will be\n downloaded
176
+ onto the Razor server:\n \n {\n \"name\": \"fedora19\",\n \"url\": \"http://mirrors.n-ix.net/fedora/linux/releases/19/Fedora/x86_64/os/\"\n \"task\":
177
+ \"fedora\"\n }\n"},"schema":{"name":{"type":"string"},"url":{"type":"string"},"iso-url":{"type":"string"},"task":{"type":"string"}}}'
178
+ http_version:
179
+ recorded_at: Thu, 14 Aug 2014 21:10:25 GMT
180
+ - request:
181
+ method: get
182
+ uri: http://localhost:8080/api/commands/create-repo
183
+ body:
184
+ encoding: US-ASCII
185
+ string: ''
186
+ headers:
187
+ Accept:
188
+ - application/json
189
+ Accept-Encoding:
190
+ - gzip, deflate
191
+ User-Agent:
192
+ - Ruby
193
+ response:
194
+ status:
195
+ code: 200
196
+ message: OK
197
+ headers:
198
+ Server:
199
+ - Apache-Coyote/1.1
200
+ Etag:
201
+ - '"server-version-v0.15.0-26-gfffaba4-dirty"'
202
+ X-Content-Type-Options:
203
+ - nosniff
204
+ Content-Type:
205
+ - application/json;charset=utf-8
206
+ Content-Length:
207
+ - '3240'
208
+ Date:
209
+ - Thu, 14 Aug 2014 21:10:25 GMT
210
+ body:
211
+ encoding: US-ASCII
212
+ string: '{"name":"create-repo","help":{"full":"# SYNOPSIS\nCreate a new repository,
213
+ from an ISO image or a URL\n\n# DESCRIPTION\nCreate a new repository, which
214
+ can either contain the content to install a\nnode, or simply point to an existing
215
+ online repository by URL.\n\n# Access Control\n\nThis command''s access control
216
+ pattern: `commands:create-repo:%{name}`\n\nWords surrounded by `%{...}` are
217
+ substitutions from the input data: typically\nthe name of the object being
218
+ modified, or some other critical detail, these\nallow roles to be granted
219
+ partial access to modify the system.\n\nFor more detail on how the permission
220
+ strings are structured and work, you can\nsee the [Shiro Permissions documentation][shiro]. That
221
+ pattern is expanded\nand then a permission check applied to it, before the
222
+ command is authorized.\n\nThese checks only apply if security is enabled in
223
+ the Razor configuration\nfile; on this server security is currently disabled.\n\n[shiro]:
224
+ http://shiro.apache.org/permissions.html\n\n# Attributes\n\n * name\n -
225
+ The name of the repository.\n - This attribute is required.\n - It must
226
+ be of type string.\n - It must be between 1 and 250 in length.\n\n * url\n -
227
+ The URL of the remote repository to use.\n - It must be of type string.\n -
228
+ If present, iso-url must not be present.\n - It must be between 1 and 1000
229
+ in length.\n\n * iso-url\n - The URL of the ISO image to download and unpack
230
+ to create the\n repository. This can be an HTTP or HTTPS URL, or it can
231
+ be a\n file URL.\n \n In the latter case, the file path is interpreted
232
+ as a path on the\n Razor server, rather than a path on the client. This
233
+ requires that\n you manually place the ISO image on the server before
234
+ invoking the\n command.\n - It must be of type string.\n - If present,
235
+ url must not be present.\n - It must be between 1 and 1000 in length.\n\n
236
+ * task\n - The name of the task associated with this repository. This is
237
+ used to\n install nodes that match a policy using this repository; generally
238
+ it\n should match the OS that the URL or ISO-URL attributes point to.\n -
239
+ This attribute is required.\n - It must be of type string.\n\n# EXAMPLES\n\n Create
240
+ a repository from an ISO image, which will be downloaded and unpacked\n by
241
+ the razor-server in the background:\n \n {\n \"name\": \"fedora19\",\n \"iso-url\":
242
+ \"http://example.com/Fedora-19-x86_64-DVD.iso\"\n \"task\": \"fedora\"\n }\n \n You
243
+ can also unpack an ISO image from a file *on the server*; this does not\n upload
244
+ the file from the client:\n {\n \"name\": \"fedora19\",\n \"iso-url\":
245
+ \"file:///tmp/Fedora-19-x86_64-DVD.iso\"\n \"task\": \"fedora\"\n }\n \n Finally,
246
+ you can provide a `url` property when you create the repository;\n this form
247
+ is merely a pointer to a resource somewhere and nothing will be\n downloaded
248
+ onto the Razor server:\n \n {\n \"name\": \"fedora19\",\n \"url\": \"http://mirrors.n-ix.net/fedora/linux/releases/19/Fedora/x86_64/os/\"\n \"task\":
249
+ \"fedora\"\n }\n"},"schema":{"name":{"type":"string"},"url":{"type":"string"},"iso-url":{"type":"string"},"task":{"type":"string"}}}'
250
+ http_version:
251
+ recorded_at: Thu, 14 Aug 2014 21:10:26 GMT
252
+ - request:
253
+ method: post
254
+ uri: http://localhost:8080/api/commands/create-repo
255
+ body:
256
+ encoding: UTF-8
257
+ string: '{"name":"''with=equals''","url":"http://url.com/some.iso","task":"noop"}'
258
+ headers:
259
+ Accept:
260
+ - application/json
261
+ Accept-Encoding:
262
+ - gzip, deflate
263
+ Content-Type:
264
+ - application/json
265
+ Content-Length:
266
+ - '70'
267
+ User-Agent:
268
+ - Ruby
269
+ response:
270
+ status:
271
+ code: 202
272
+ message: Accepted
273
+ headers:
274
+ Server:
275
+ - Apache-Coyote/1.1
276
+ X-Content-Type-Options:
277
+ - nosniff
278
+ Content-Type:
279
+ - application/json;charset=utf-8
280
+ Content-Length:
281
+ - '219'
282
+ Date:
283
+ - Thu, 14 Aug 2014 21:10:25 GMT
284
+ body:
285
+ encoding: US-ASCII
286
+ string: '{"spec":"http://api.puppetlabs.com/razor/v1/collections/repos/member","id":"http://localhost:8080/api/collections/repos/''with=equals''","name":"''with=equals''","command":"http://localhost:8080/api/collections/commands/1"}'
287
+ http_version:
288
+ recorded_at: Thu, 14 Aug 2014 21:10:26 GMT
289
+ - request:
290
+ method: get
291
+ uri: http://localhost:8080/api/collections/repos/'with=equals'
292
+ body:
293
+ encoding: US-ASCII
294
+ string: ''
295
+ headers:
296
+ Accept:
297
+ - application/json
298
+ Accept-Encoding:
299
+ - gzip, deflate
300
+ User-Agent:
301
+ - Ruby
302
+ response:
303
+ status:
304
+ code: 200
305
+ message: OK
306
+ headers:
307
+ Server:
308
+ - Apache-Coyote/1.1
309
+ X-Content-Type-Options:
310
+ - nosniff
311
+ Content-Type:
312
+ - application/json;charset=utf-8
313
+ Content-Length:
314
+ - '353'
315
+ Date:
316
+ - Thu, 14 Aug 2014 21:10:25 GMT
317
+ body:
318
+ encoding: US-ASCII
319
+ string: '{"spec":"http://api.puppetlabs.com/razor/v1/collections/repos/member","id":"http://localhost:8080/api/collections/repos/''with=equals''","name":"''with=equals''","iso_url":null,"url":"http://url.com/some.iso","task":{"spec":"http://api.puppetlabs.com/razor/v1/collections/tasks/member","id":"http://localhost:8080/api/collections/tasks/noop","name":"noop"}}'
320
+ http_version:
321
+ recorded_at: Thu, 14 Aug 2014 21:10:26 GMT
322
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,110 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8080/api
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ Content-Type:
26
+ - application/json;charset=utf-8
27
+ Content-Length:
28
+ - '4975'
29
+ Date:
30
+ - Mon, 25 Aug 2014 20:56:24 GMT
31
+ body:
32
+ encoding: US-ASCII
33
+ string: '{"commands":[{"name":"add-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/add-policy-tag","id":"http://localhost:8080/api/commands/add-policy-tag"},{"name":"create-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/create-broker","id":"http://localhost:8080/api/commands/create-broker"},{"name":"create-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/create-policy","id":"http://localhost:8080/api/commands/create-policy"},{"name":"create-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/create-repo","id":"http://localhost:8080/api/commands/create-repo"},{"name":"create-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/create-tag","id":"http://localhost:8080/api/commands/create-tag"},{"name":"create-task","rel":"http://api.puppetlabs.com/razor/v1/commands/create-task","id":"http://localhost:8080/api/commands/create-task"},{"name":"delete-broker","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-broker","id":"http://localhost:8080/api/commands/delete-broker"},{"name":"delete-node","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-node","id":"http://localhost:8080/api/commands/delete-node"},{"name":"delete-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-policy","id":"http://localhost:8080/api/commands/delete-policy"},{"name":"delete-repo","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-repo","id":"http://localhost:8080/api/commands/delete-repo"},{"name":"delete-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/delete-tag","id":"http://localhost:8080/api/commands/delete-tag"},{"name":"disable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/disable-policy","id":"http://localhost:8080/api/commands/disable-policy"},{"name":"enable-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/enable-policy","id":"http://localhost:8080/api/commands/enable-policy"},{"name":"modify-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/modify-node-metadata","id":"http://localhost:8080/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:8080/api/commands/modify-policy-max-count"},{"name":"move-policy","rel":"http://api.puppetlabs.com/razor/v1/commands/move-policy","id":"http://localhost:8080/api/commands/move-policy"},{"name":"reboot-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reboot-node","id":"http://localhost:8080/api/commands/reboot-node"},{"name":"register-node","rel":"http://api.puppetlabs.com/razor/v1/commands/register-node","id":"http://localhost:8080/api/commands/register-node"},{"name":"reinstall-node","rel":"http://api.puppetlabs.com/razor/v1/commands/reinstall-node","id":"http://localhost:8080/api/commands/reinstall-node"},{"name":"remove-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-node-metadata","id":"http://localhost:8080/api/commands/remove-node-metadata"},{"name":"remove-policy-tag","rel":"http://api.puppetlabs.com/razor/v1/commands/remove-policy-tag","id":"http://localhost:8080/api/commands/remove-policy-tag"},{"name":"set-node-desired-power-state","rel":"http://api.puppetlabs.com/razor/v1/commands/set-node-desired-power-state","id":"http://localhost:8080/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:8080/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:8080/api/commands/set-node-ipmi-credentials"},{"name":"update-node-metadata","rel":"http://api.puppetlabs.com/razor/v1/commands/update-node-metadata","id":"http://localhost:8080/api/commands/update-node-metadata"},{"name":"update-tag-rule","rel":"http://api.puppetlabs.com/razor/v1/commands/update-tag-rule","id":"http://localhost:8080/api/commands/update-tag-rule"}],"collections":[{"name":"brokers","rel":"http://api.puppetlabs.com/razor/v1/collections/brokers","id":"http://localhost:8080/api/collections/brokers"},{"name":"repos","rel":"http://api.puppetlabs.com/razor/v1/collections/repos","id":"http://localhost:8080/api/collections/repos"},{"name":"tags","rel":"http://api.puppetlabs.com/razor/v1/collections/tags","id":"http://localhost:8080/api/collections/tags"},{"name":"policies","rel":"http://api.puppetlabs.com/razor/v1/collections/policies","id":"http://localhost:8080/api/collections/policies"},{"name":"nodes","rel":"http://api.puppetlabs.com/razor/v1/collections/nodes","id":"http://localhost:8080/api/collections/nodes"},{"name":"tasks","rel":"http://api.puppetlabs.com/razor/v1/collections/tasks","id":"http://localhost:8080/api/collections/tasks"},{"name":"commands","rel":"http://api.puppetlabs.com/razor/v1/collections/commands","id":"http://localhost:8080/api/collections/commands"}],"version":{"server":"v0.15.0-32-g1a997ad"}}'
34
+ http_version:
35
+ recorded_at: Mon, 25 Aug 2014 20:56:24 GMT
36
+ - request:
37
+ method: get
38
+ uri: http://localhost:8080/api/commands/update-tag-rule
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ''
42
+ headers:
43
+ Accept:
44
+ - application/json
45
+ Accept-Encoding:
46
+ - gzip, deflate
47
+ User-Agent:
48
+ - Ruby
49
+ response:
50
+ status:
51
+ code: 200
52
+ message: OK
53
+ headers:
54
+ Server:
55
+ - Apache-Coyote/1.1
56
+ Etag:
57
+ - '"server-version-v0.15.0-32-g1a997ad"'
58
+ X-Content-Type-Options:
59
+ - nosniff
60
+ Content-Type:
61
+ - application/json;charset=utf-8
62
+ Content-Length:
63
+ - '3255'
64
+ Date:
65
+ - Mon, 25 Aug 2014 20:56:24 GMT
66
+ body:
67
+ encoding: US-ASCII
68
+ string: '{"name":"update-tag-rule","help":{"summary":"Update the matching rule
69
+ for an existing tag","description":"This will change the rule of the given
70
+ tag to the new rule. The tag will be\nreevaluated against all nodes and each
71
+ node''s tag attribute will be updated to\nreflect whether the tag now matches
72
+ or not, i.e., the tag will be added\nto/removed from each node''s tag as appropriate.\n\nIf
73
+ the tag is used by any policies, the update will only be performed if the\noptional
74
+ parameter `force` is set to `true`. Otherwise, it will fail.","schema":"\n#
75
+ Access Control\n\nThis command''s access control pattern: `commands:update-tag-rule:%{name}`\n\nWords
76
+ surrounded by `%{...}` are substitutions from the input data: typically\nthe
77
+ name of the object being modified, or some other critical detail, these\nallow
78
+ roles to be granted partial access to modify the system.\n\nFor more detail
79
+ on how the permission strings are structured and work, you can\nsee the [Shiro
80
+ Permissions documentation][shiro]. That pattern is expanded\nand then a permission
81
+ check applied to it, before the command is authorized.\n\nThese checks only
82
+ apply if security is enabled in the Razor configuration\nfile; on this server
83
+ security is currently disabled.\n\n[shiro]: http://shiro.apache.org/permissions.html\n\n#
84
+ Attributes\n\n * name\n - The tag for which to change the rule.\n - This
85
+ attribute is required.\n - It must be of type string.\n - It must match
86
+ the name of an existing tag.\n\n * rule\n - The new rule to apply to the
87
+ tag.\n - This attribute is required.\n - It must be of type array.\n\n
88
+ * force\n - By default this command will fail if the tag is in use by an
89
+ existing\n policy. This flag allows you to override that, and force the
90
+ change to\n apply despite the tag being in use.\n \n This will
91
+ not change policy binding of nodes, which may lead to some\n counter-intuitive
92
+ results such as a node that does *not* match policy\n tags being bound
93
+ to the policy.\n - It must be of type boolean.\n","examples":{"api":"An
94
+ example of updating a tag rule, and forcing reevaluation:\n\n{\n \"name\":
95
+ \"small\",\n \"rule\": [\"<=\", [\"fact\", \"processorcount\"], \"2\"],\n \"force\":
96
+ true\n}","cli":"An example of updating a tag rule, and forcing reevaluation:\n\nrazor
97
+ update-tag-rule --name small --force --rule ''[\"<=\", [\"fact\",
98
+ \"processorcount\"], \"2\"]''"},"full":"# SYNOPSIS\nUpdate the matching rule
99
+ for an existing tag\n\n# DESCRIPTION\nThis will change the rule of the given
100
+ tag to the new rule. The tag will be\nreevaluated against all nodes and each
101
+ node''s tag attribute will be updated to\nreflect whether the tag now matches
102
+ or not, i.e., the tag will be added\nto/removed from each node''s tag as appropriate.\n\nIf
103
+ the tag is used by any policies, the update will only be performed if the\noptional
104
+ parameter `force` is set to `true`. Otherwise, it will fail.\n#<Razor::Validation::HashSchema:0x110c667>\n#
105
+ EXAMPLES\n\n An example of updating a tag rule, and forcing reevaluation:\n \n {\n \"name\":
106
+ \"small\",\n \"rule\": [\"<=\", [\"fact\", \"processorcount\"], \"2\"],\n \"force\":
107
+ true\n }\n"},"schema":{"name":{"type":"string"},"rule":{"type":"array"},"force":{"type":"boolean"}}}'
108
+ http_version:
109
+ recorded_at: Mon, 25 Aug 2014 20:56:24 GMT
110
+ recorded_with: VCR 2.9.2