razor-client 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.md +18 -0
- data/bin/razor +9 -4
- data/lib/razor/cli.rb +10 -0
- data/lib/razor/cli/document.rb +59 -0
- data/lib/razor/cli/format.rb +70 -20
- data/lib/razor/cli/navigate.rb +114 -25
- data/lib/razor/cli/parse.rb +79 -10
- data/lib/razor/cli/transforms.rb +39 -0
- data/lib/razor/cli/version.rb +46 -0
- data/lib/razor/cli/views.rb +25 -0
- data/lib/razor/cli/views.yaml +189 -0
- data/spec/cli/format_spec.rb +77 -0
- data/spec/cli/navigate_spec.rb +102 -2
- data/spec/cli/parse_spec.rb +20 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_spaces.yml +966 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_--help_command_.yml +99 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_-h_command_.yml +99 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_--help_.yml +99 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_-h_.yml +99 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_help_.yml +99 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_help_command_.yml +99 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_preserve_that_across_navigation.yml +9 -42
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_supply_that_to_the_API_service.yml +5 -5
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_bad_JSON.yml +228 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_malformed_argument.yml +120 -0
- 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 +2006 -0
- 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 +2006 -0
- 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 +2006 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_construct_a_json_object.yml +234 -0
- 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 +228 -0
- 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 +164 -0
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_no_parameters/should_fail_with_bad_JSON.yml +36 -0
- data/spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/should_print_a_list_of_known_endpoints.yml +5 -5
- data/spec/spec_helper.rb +12 -1
- data/spec/testing.md +16 -0
- data/spec/version_spec.rb +8 -0
- metadata +74 -66
- data/.gitignore +0 -7
- data/.yardopts +0 -2
- data/Gemfile +0 -35
- data/Gemfile.lock +0 -53
- data/Rakefile +0 -37
- data/lib/razor/cli/navigate.yaml +0 -28
- data/razor-client.gemspec +0 -32
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_a_single_item_path/.yml +0 -69
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_an_invalid_path/.yml +0 -36
- data/spec/fixtures/vcr/Razor_CLI_Navigate/with_no_path/.yml +0 -36
- data/spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/.yml +0 -36
@@ -0,0 +1,164 @@
|
|
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
|
+
- '4982'
|
29
|
+
Date:
|
30
|
+
- Fri, 16 May 2014 22:18:39 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.14.1-113-g8b33d83-dirty"}}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Fri, 16 May 2014 22:18:39 GMT
|
36
|
+
- request:
|
37
|
+
method: get
|
38
|
+
uri: http://localhost:8080/api/commands/create-broker
|
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.14.1-113-g8b33d83-dirty"'
|
58
|
+
X-Content-Type-Options:
|
59
|
+
- nosniff
|
60
|
+
Content-Type:
|
61
|
+
- application/json;charset=utf-8
|
62
|
+
Content-Length:
|
63
|
+
- '2496'
|
64
|
+
Date:
|
65
|
+
- Fri, 16 May 2014 22:18:39 GMT
|
66
|
+
body:
|
67
|
+
encoding: US-ASCII
|
68
|
+
string: '{"name":"create-broker","help":{"full":"# SYNOPSIS\nCreate a new broker
|
69
|
+
configuration for hand-off of installed nodes\n\n# DESCRIPTION\nCreate a new
|
70
|
+
broker configuration. Brokers are responsible for handing a node\noff to
|
71
|
+
a config management system, such as Puppet or Chef. In cases where you\nhave
|
72
|
+
no configuration management system, you can use the `noop` broker.\n\n\n#
|
73
|
+
Access Control\n\nThis command''s access control pattern: `commands:create-broker:%{name}`\n\nWords
|
74
|
+
surrounded by `%{...}` are substitutions from the input data: typically\nthe
|
75
|
+
name of the object being modified, or some other critical detail, these\nallow
|
76
|
+
roles to be granted partial access to modify the system.\n\nFor more detail
|
77
|
+
on how the permission strings are structured and work, you can\nsee the [Shiro
|
78
|
+
Permissions documentation][shiro]. That pattern is expanded\nand then a permission
|
79
|
+
check applied to it, before the command is authorized.\n\nThese checks only
|
80
|
+
apply if security is enabled in the Razor configuration\nfile; on this server
|
81
|
+
security is currently disabled.\n\n[shiro]: http://shiro.apache.org/permissions.html\n\n#
|
82
|
+
Attributes\n\n * name\n - The name of the broker, as it will be referenced
|
83
|
+
within Razor.\n This is the name that you supply to, eg, `create-policy`
|
84
|
+
to specify\n which broker the node will be handed off via after installation.\n -
|
85
|
+
This attribute is required\n - It must be of type string.\n - It must
|
86
|
+
be between 1 and 250 in length.\n\n * broker-type\n - The broker type that
|
87
|
+
this broker is created from. The available\n broker types on your server
|
88
|
+
are:\n - chef\n - noop\n - puppet-pe\n - puppet\n - This
|
89
|
+
attribute is required\n - It must be of type string.\n - It must match
|
90
|
+
the name of an existing broker type.\n\n * configuration\n - The configuration
|
91
|
+
for the broker. The acceptable values here are\n determined by the `broker-type`
|
92
|
+
selected. In general this has\n settings like which server to contact,
|
93
|
+
and other configuration\n related to handing on the newly installed system
|
94
|
+
to the final\n configuration management system.\n - It must be of type
|
95
|
+
object.\n \n \n\n\n\n# EXAMPLES\n Creating a simple Puppet broker:\n \n {\n \"name\":
|
96
|
+
\"puppet\",\n \"configuration\": {\n \"server\": \"puppet.example.org\",\n \"environment\":
|
97
|
+
\"production\"\n },\n \"broker-type\": \"puppet\"\n }\n\n"},"schema":{"name":{"type":"string"},"broker-type":{"type":"string"},"configuration":{"type":"object"}}}'
|
98
|
+
http_version:
|
99
|
+
recorded_at: Fri, 16 May 2014 22:18:39 GMT
|
100
|
+
- request:
|
101
|
+
method: get
|
102
|
+
uri: http://localhost:8080/api/commands/create-broker
|
103
|
+
body:
|
104
|
+
encoding: US-ASCII
|
105
|
+
string: ''
|
106
|
+
headers:
|
107
|
+
Accept:
|
108
|
+
- application/json
|
109
|
+
Accept-Encoding:
|
110
|
+
- gzip, deflate
|
111
|
+
User-Agent:
|
112
|
+
- Ruby
|
113
|
+
response:
|
114
|
+
status:
|
115
|
+
code: 200
|
116
|
+
message: OK
|
117
|
+
headers:
|
118
|
+
Server:
|
119
|
+
- Apache-Coyote/1.1
|
120
|
+
Etag:
|
121
|
+
- '"server-version-v0.14.1-113-g8b33d83-dirty"'
|
122
|
+
X-Content-Type-Options:
|
123
|
+
- nosniff
|
124
|
+
Content-Type:
|
125
|
+
- application/json;charset=utf-8
|
126
|
+
Content-Length:
|
127
|
+
- '2496'
|
128
|
+
Date:
|
129
|
+
- Fri, 16 May 2014 22:18:39 GMT
|
130
|
+
body:
|
131
|
+
encoding: US-ASCII
|
132
|
+
string: '{"name":"create-broker","help":{"full":"# SYNOPSIS\nCreate a new broker
|
133
|
+
configuration for hand-off of installed nodes\n\n# DESCRIPTION\nCreate a new
|
134
|
+
broker configuration. Brokers are responsible for handing a node\noff to
|
135
|
+
a config management system, such as Puppet or Chef. In cases where you\nhave
|
136
|
+
no configuration management system, you can use the `noop` broker.\n\n\n#
|
137
|
+
Access Control\n\nThis command''s access control pattern: `commands:create-broker:%{name}`\n\nWords
|
138
|
+
surrounded by `%{...}` are substitutions from the input data: typically\nthe
|
139
|
+
name of the object being modified, or some other critical detail, these\nallow
|
140
|
+
roles to be granted partial access to modify the system.\n\nFor more detail
|
141
|
+
on how the permission strings are structured and work, you can\nsee the [Shiro
|
142
|
+
Permissions documentation][shiro]. That pattern is expanded\nand then a permission
|
143
|
+
check applied to it, before the command is authorized.\n\nThese checks only
|
144
|
+
apply if security is enabled in the Razor configuration\nfile; on this server
|
145
|
+
security is currently disabled.\n\n[shiro]: http://shiro.apache.org/permissions.html\n\n#
|
146
|
+
Attributes\n\n * name\n - The name of the broker, as it will be referenced
|
147
|
+
within Razor.\n This is the name that you supply to, eg, `create-policy`
|
148
|
+
to specify\n which broker the node will be handed off via after installation.\n -
|
149
|
+
This attribute is required\n - It must be of type string.\n - It must
|
150
|
+
be between 1 and 250 in length.\n\n * broker-type\n - The broker type that
|
151
|
+
this broker is created from. The available\n broker types on your server
|
152
|
+
are:\n - chef\n - noop\n - puppet-pe\n - puppet\n - This
|
153
|
+
attribute is required\n - It must be of type string.\n - It must match
|
154
|
+
the name of an existing broker type.\n\n * configuration\n - The configuration
|
155
|
+
for the broker. The acceptable values here are\n determined by the `broker-type`
|
156
|
+
selected. In general this has\n settings like which server to contact,
|
157
|
+
and other configuration\n related to handing on the newly installed system
|
158
|
+
to the final\n configuration management system.\n - It must be of type
|
159
|
+
object.\n \n \n\n\n\n# EXAMPLES\n Creating a simple Puppet broker:\n \n {\n \"name\":
|
160
|
+
\"puppet\",\n \"configuration\": {\n \"server\": \"puppet.example.org\",\n \"environment\":
|
161
|
+
\"production\"\n },\n \"broker-type\": \"puppet\"\n }\n\n"},"schema":{"name":{"type":"string"},"broker-type":{"type":"string"},"configuration":{"type":"object"}}}'
|
162
|
+
http_version:
|
163
|
+
recorded_at: Fri, 16 May 2014 22:18:39 GMT
|
164
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,36 @@
|
|
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
|
+
- '4982'
|
29
|
+
Date:
|
30
|
+
- Fri, 16 May 2014 21:36:00 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.14.1-113-g8b33d83-dirty"}}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Fri, 16 May 2014 21:36:00 GMT
|
36
|
+
recorded_with: VCR 2.5.0
|
data/spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/should_print_a_list_of_known_endpoints.yml
CHANGED
@@ -25,12 +25,12 @@ http_interactions:
|
|
25
25
|
Content-Type:
|
26
26
|
- application/json;charset=utf-8
|
27
27
|
Content-Length:
|
28
|
-
- '
|
28
|
+
- '4982'
|
29
29
|
Date:
|
30
|
-
-
|
30
|
+
- Fri, 16 May 2014 21:38:24 GMT
|
31
31
|
body:
|
32
32
|
encoding: US-ASCII
|
33
|
-
string:
|
34
|
-
http_version:
|
35
|
-
recorded_at:
|
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.14.1-113-g8b33d83-dirty"}}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Fri, 16 May 2014 21:38:24 GMT
|
36
36
|
recorded_with: VCR 2.5.0
|
data/spec/spec_helper.rb
CHANGED
@@ -26,6 +26,12 @@ VCR.configure do |c|
|
|
26
26
|
:record => vcr_record_mode
|
27
27
|
}
|
28
28
|
end
|
29
|
+
def reset_db
|
30
|
+
razor_admin_path = ENV['razor-admin'] || 'bin/razor-admin'
|
31
|
+
db_environment = ENV['server-database-environment'] || 'development'
|
32
|
+
# The `cd` business is a workaround, since running `razor-admin` from a different directory currently fails.
|
33
|
+
system("cd ../razor-server && #{razor_admin_path} -e #{db_environment} reset-database")
|
34
|
+
end
|
29
35
|
|
30
36
|
# Record one cassette for each test
|
31
37
|
RSpec.configure do |c|
|
@@ -33,4 +39,9 @@ RSpec.configure do |c|
|
|
33
39
|
c.before(:each) do
|
34
40
|
ENV::delete('RAZOR_API')
|
35
41
|
end
|
36
|
-
|
42
|
+
# Make tests have no side effects when [re-]recording.
|
43
|
+
if vcr_recording?
|
44
|
+
c.before(:all) { reset_db }
|
45
|
+
c.after(:each) { reset_db }
|
46
|
+
end
|
47
|
+
end
|
data/spec/testing.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
For developers:
|
2
|
+
|
3
|
+
Client-side spec tests use a framework called VCR for testing the client independent of the server. VCR fakes the
|
4
|
+
interactions from the server so the client can continue executing its code. It does this by copying the exact
|
5
|
+
expected input, then replying with the response provided by the server when the test is executed in a "record" mode.
|
6
|
+
|
7
|
+
When writing these tests, keep in mind that other developers may need to rerecord tests. This can occur if a
|
8
|
+
request to the server is somehow different, or if the client needs to issue a new request to the server.
|
9
|
+
|
10
|
+
Here are some suggestions to make rerecording easier:
|
11
|
+
|
12
|
+
- If a request has external dependencies, set up the dependencies as part of (or before) the test.
|
13
|
+
- For example, let's say you're testing the `create-policy` command. Execution of that command requires several
|
14
|
+
objects be present in the database: brokers, repos, etc. The only way to issue the `create-policy` command
|
15
|
+
successfully on the client is to issue `create-broker`, `create-repo`, etc. beforehand. These extra commands
|
16
|
+
should be part of the test.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: razor-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mime-types
|
@@ -75,75 +75,69 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rake
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
description: The client for the Razor server
|
111
|
-
email:
|
112
|
-
- info@puppetlabs.com
|
78
|
+
description: ! 'Razor is an advanced provisioning application which can deploy both
|
79
|
+
bare-metal
|
80
|
+
|
81
|
+
and virtual systems. It''s aimed at solving the problem of how to bring new
|
82
|
+
|
83
|
+
metal into a state where your existing DevOps/configuration management
|
84
|
+
|
85
|
+
workflows can take it over.
|
86
|
+
|
87
|
+
|
88
|
+
This provides the client application gem, used to provide CLI access and control
|
89
|
+
|
90
|
+
to users of razor-server.
|
91
|
+
|
92
|
+
'
|
93
|
+
email: info@puppetlabs.com
|
113
94
|
executables:
|
114
95
|
- razor
|
115
96
|
extensions: []
|
116
97
|
extra_rdoc_files: []
|
117
98
|
files:
|
118
|
-
- .gitignore
|
119
|
-
- .yardopts
|
120
|
-
- Gemfile
|
121
|
-
- Gemfile.lock
|
122
|
-
- LICENSE
|
123
|
-
- README.md
|
124
|
-
- Rakefile
|
125
99
|
- bin/razor
|
126
100
|
- lib/razor.rb
|
127
|
-
- lib/razor/cli.rb
|
101
|
+
- lib/razor/cli/views.rb
|
128
102
|
- lib/razor/cli/format.rb
|
129
103
|
- lib/razor/cli/navigate.rb
|
130
|
-
- lib/razor/cli/
|
104
|
+
- lib/razor/cli/version.rb
|
105
|
+
- lib/razor/cli/views.yaml
|
131
106
|
- lib/razor/cli/parse.rb
|
132
|
-
- razor
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
107
|
+
- lib/razor/cli/transforms.rb
|
108
|
+
- lib/razor/cli/document.rb
|
109
|
+
- lib/razor/cli.rb
|
110
|
+
- NEWS.md
|
111
|
+
- README.md
|
112
|
+
- LICENSE
|
113
|
+
- 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
|
114
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_construct_a_json_object.yml
|
115
|
+
- 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
|
116
|
+
- 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
|
117
|
+
- 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
|
118
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_the_arguments_as_an_array.yml
|
119
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_malformed_argument.yml
|
120
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_bad_JSON.yml
|
137
121
|
- spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_preserve_that_across_navigation.yml
|
138
122
|
- spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_supply_that_to_the_API_service.yml
|
139
|
-
- spec/fixtures/vcr/Razor_CLI_Navigate/
|
140
|
-
- spec/fixtures/vcr/
|
123
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_help_command_.yml
|
124
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_-h_.yml
|
125
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_--help_command_.yml
|
126
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_--help_.yml
|
127
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_help_.yml
|
128
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_-h_command_.yml
|
129
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_spaces.yml
|
130
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_no_parameters/should_fail_with_bad_JSON.yml
|
141
131
|
- spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/should_print_a_list_of_known_endpoints.yml
|
142
|
-
- spec/
|
132
|
+
- spec/cli/parse_spec.rb
|
133
|
+
- spec/cli/format_spec.rb
|
134
|
+
- spec/cli/navigate_spec.rb
|
143
135
|
- spec/vcr_library.rb
|
144
|
-
|
145
|
-
|
146
|
-
-
|
136
|
+
- spec/testing.md
|
137
|
+
- spec/version_spec.rb
|
138
|
+
- spec/spec_helper.rb
|
139
|
+
homepage: http://puppetlabs.com/puppet/puppet-enterprise
|
140
|
+
licenses: []
|
147
141
|
post_install_message:
|
148
142
|
rdoc_options: []
|
149
143
|
require_paths:
|
@@ -165,17 +159,31 @@ rubyforge_project:
|
|
165
159
|
rubygems_version: 1.8.23
|
166
160
|
signing_key:
|
167
161
|
specification_version: 3
|
168
|
-
summary:
|
162
|
+
summary: Razor is an advanced provisioning application
|
169
163
|
test_files:
|
170
|
-
- spec/
|
171
|
-
- spec/
|
172
|
-
- spec/fixtures/vcr/Razor_CLI_Navigate/
|
173
|
-
- spec/fixtures/vcr/Razor_CLI_Navigate/
|
164
|
+
- 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
|
165
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_object/should_construct_a_json_object.yml
|
166
|
+
- 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
|
167
|
+
- 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
|
168
|
+
- 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
|
169
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_multiple_arguments_with_same_name/combining_as_an_array/should_merge_the_arguments_as_an_array.yml
|
170
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_malformed_argument.yml
|
171
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_invalid_parameter/should_fail_with_bad_JSON.yml
|
174
172
|
- spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_preserve_that_across_navigation.yml
|
175
173
|
- spec/fixtures/vcr/Razor_CLI_Navigate/with_authentication/should_supply_that_to_the_API_service.yml
|
176
|
-
- spec/fixtures/vcr/Razor_CLI_Navigate/
|
177
|
-
- spec/fixtures/vcr/
|
174
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_help_command_.yml
|
175
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_-h_.yml
|
176
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_--help_command_.yml
|
177
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_--help_.yml
|
178
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_command_help_.yml
|
179
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/for_command_help/should_provide_command_help_for_razor_-h_command_.yml
|
180
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/argument_formatting/should_allow_spaces.yml
|
181
|
+
- spec/fixtures/vcr/Razor_CLI_Navigate/with_no_parameters/should_fail_with_bad_JSON.yml
|
178
182
|
- spec/fixtures/vcr/Razor_CLI_Parse/_new/_help/should_print_a_list_of_known_endpoints.yml
|
179
|
-
- spec/
|
183
|
+
- spec/cli/parse_spec.rb
|
184
|
+
- spec/cli/format_spec.rb
|
185
|
+
- spec/cli/navigate_spec.rb
|
180
186
|
- spec/vcr_library.rb
|
181
|
-
|
187
|
+
- spec/testing.md
|
188
|
+
- spec/version_spec.rb
|
189
|
+
- spec/spec_helper.rb
|