summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2014-04-14 15:18:36 -0700
committerJohn Keiser <jkeiser@opscode.com>2014-04-14 15:18:36 -0700
commitd66376d5a813fe11a6272ce890fd36bfd32ca0db (patch)
treeb53100b14eaafa03f589556b833b80577f94158e
parentd74e5b8abe16abf98ece81583b2f4abc5a8e7fae (diff)
downloadchef-zero-d66376d5a813fe11a6272ce890fd36bfd32ca0db.tar.gz
Fixes against latest pedant
-rw-r--r--Gemfile3
-rw-r--r--lib/chef_zero/endpoints/actor_endpoint.rb10
-rw-r--r--lib/chef_zero/endpoints/rest_object_endpoint.rb4
-rw-r--r--lib/chef_zero/rest_request.rb1
-rw-r--r--spec/support/pedant.rb4
5 files changed, 10 insertions, 12 deletions
diff --git a/Gemfile b/Gemfile
index 8700793..a0bf254 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,6 @@
source 'https://rubygems.org'
gemspec
-gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => '2c58a3736ba880503394f66c4435b063dececdc5'
+gem 'rest-client', :git => 'git://github.com/opscode/rest-client.git'
+gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => 'dbacba4f85e944bd71ea4e9d5324d266750ffc10'
gem 'chef', '>= 11.0'
diff --git a/lib/chef_zero/endpoints/actor_endpoint.rb b/lib/chef_zero/endpoints/actor_endpoint.rb
index 467422b..352a682 100644
--- a/lib/chef_zero/endpoints/actor_endpoint.rb
+++ b/lib/chef_zero/endpoints/actor_endpoint.rb
@@ -37,17 +37,12 @@ module ChefZero
result = super(request)
# Inject private_key into response, delete public_key/password if applicable
- if result[0] == 200
+ if result[0] == 200 || result[0] == 201
response = JSON.parse(result[2], :create_additions => false)
response['private_key'] = private_key if private_key
response.delete('public_key') if !updating_public_key && request.rest_path[0] == 'users'
response.delete('password')
- # For PUT /clients, a rename returns 201.
- if request_body['name'] && request.rest_path[1] != request_body['name']
- json_response(201, response)
- else
- json_response(200, response)
- end
+ json_response(result[0], response)
else
result
end
@@ -65,4 +60,3 @@ module ChefZero
end
end
end
-
diff --git a/lib/chef_zero/endpoints/rest_object_endpoint.rb b/lib/chef_zero/endpoints/rest_object_endpoint.rb
index de280a8..a3ce13d 100644
--- a/lib/chef_zero/endpoints/rest_object_endpoint.rb
+++ b/lib/chef_zero/endpoints/rest_object_endpoint.rb
@@ -31,10 +31,11 @@ module ChefZero
return error(409, "Cannot rename '#{request.rest_path[-1]}' to '#{key}': '#{key}' already exists")
end
delete_data(request)
+ already_json_response(201, populate_defaults(request, request.body))
else
set_data(request, request.rest_path, request.body)
+ already_json_response(200, populate_defaults(request, request.body))
end
- already_json_response(200, populate_defaults(request, request.body))
end
def delete(request)
@@ -58,4 +59,3 @@ module ChefZero
end
end
end
-
diff --git a/lib/chef_zero/rest_request.rb b/lib/chef_zero/rest_request.rb
index ff44558..8adefd4 100644
--- a/lib/chef_zero/rest_request.rb
+++ b/lib/chef_zero/rest_request.rb
@@ -53,4 +53,3 @@ module ChefZero
end
end
end
-
diff --git a/spec/support/pedant.rb b/spec/support/pedant.rb
index 0210858..d21a2f7 100644
--- a/spec/support/pedant.rb
+++ b/spec/support/pedant.rb
@@ -41,6 +41,10 @@ chef_server 'http://127.0.0.1:8889'
# differs significantly from this.
maximum_search_time 0
+# OSC sends erchef a host header with a port, so this option needs
+# # to be enabled for Pedant tests to work correctly
+explicit_port_url true
+
# We're starting to break tests up into groups based on different
# criteria. The proper API tests (the results of which are viewable
# to OPC customers) should be the only ones run by Pedant embedded in