summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Miller <jeremymv2@users.noreply.github.com>2017-05-25 14:27:37 -0500
committerThom May <thom@may.lt>2017-05-25 14:27:37 -0500
commit73ed88e08a3be39128481ebfdd08ac6e170b4965 (patch)
tree5f80dc47c51e8ee1770c5de7db0a0e3d0ab59ced
parent0888deece36b15362f1d1eae9543c26b157dfd9c (diff)
downloadchef-zero-73ed88e08a3be39128481ebfdd08ac6e170b4965.tar.gz
implement rfc090 for named nodes endpoint (#264)
* implement rfc090 for named nodes endpoint Signed-off-by: Jeremy J. Miller <jm@chef.io>
-rw-r--r--lib/chef_zero/endpoints/node_endpoint.rb4
-rw-r--r--lib/chef_zero/rest_base.rb10
-rw-r--r--spec/run_oc_pedant.rb4
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/node_endpoint.rb b/lib/chef_zero/endpoints/node_endpoint.rb
index 98e88a0..471bc4a 100644
--- a/lib/chef_zero/endpoints/node_endpoint.rb
+++ b/lib/chef_zero/endpoints/node_endpoint.rb
@@ -20,6 +20,10 @@ module ChefZero
super(request)
end
+ def head(request)
+ head_request(request)
+ end
+
def populate_defaults(request, response_json)
node = FFI_Yajl::Parser.parse(response_json)
node = ChefData::DataNormalizer.normalize_node(node, request.rest_path[3])
diff --git a/lib/chef_zero/rest_base.rb b/lib/chef_zero/rest_base.rb
index 367ce70..74ca014 100644
--- a/lib/chef_zero/rest_base.rb
+++ b/lib/chef_zero/rest_base.rb
@@ -231,6 +231,16 @@ module ChefZero
[response_code, { "Content-Type" => "text/plain" }, text]
end
+ # rfc090 returns 404 error or 200 with an emtpy body
+ # @param [ChefZero::RestRequest] request The HTTP request object
+ #
+ # @return (see #json_response)
+ #
+ def head_request(request)
+ get_data(request) # will raise 404 if non-existant
+ json_response(200, nil)
+ end
+
# Returns an Array with the response code, HTTP headers, and JSON body.
#
# @param [Fixnum] response_code The HTTP response code
diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb
index c11eb4a..411b502 100644
--- a/spec/run_oc_pedant.rb
+++ b/spec/run_oc_pedant.rb
@@ -161,6 +161,10 @@ begin
# Chef Zero does not intend to support authorization the way erchef does.
"--skip-authorization",
+ # Chef Zero does not intend to support oc_id authentication/authorization
+ # the way erchef does.
+ "--skip-oc_id",
+
# Omnibus tests depend on erchef features that are specific to erchef and
# bundled in the omnibus package. Currently the only test in this category
# is for the search reindexing script.