summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjkeiser <jkeiser@opscode.com>2012-12-20 18:09:14 -0800
committerjkeiser <jkeiser@opscode.com>2012-12-20 18:09:14 -0800
commit7d1fab82ff572fdde5a53650880bee50ae214894 (patch)
treead68fb3bc05dd685502f5b36939065f1a6edc6b9 /lib
parent31e0f614eabe9f431a53ad8b8a09109f77d3d4db (diff)
downloadchef-zero-7d1fab82ff572fdde5a53650880bee50ae214894.tar.gz
Support DELETE /cookbook/NAME/_latest
Diffstat (limited to 'lib')
-rw-r--r--lib/chef_zero/endpoints/cookbook_version_endpoint.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef_zero/endpoints/cookbook_version_endpoint.rb b/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
index 1ff74e8..7712fac 100644
--- a/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
+++ b/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
@@ -8,7 +8,7 @@ module ChefZero
# /cookbooks/NAME/VERSION
class CookbookVersionEndpoint < RestObjectEndpoint
def get(request)
- if request.rest_path[2] == "_latest"
+ if request.rest_path[2] == "_latest" || request.rest_path[2] == "latest"
request.rest_path[2] = latest_version(get_data(request, request.rest_path[0..1]).keys)
end
super(request)
@@ -51,6 +51,10 @@ module ChefZero
end
def delete(request)
+ if request.rest_path[2] == "_latest" || request.rest_path[2] == "latest"
+ request.rest_path[2] = latest_version(get_data(request, request.rest_path[0..1]).keys)
+ end
+
deleted_cookbook = get_data(request, request.rest_path)
response = super(request)
cookbook_name = request.rest_path[1]