diff options
Diffstat (limited to 'lib/chef_zero/endpoints/cookbook_artifacts_cookbook_identifier.rb')
-rw-r--r-- | lib/chef_zero/endpoints/cookbook_artifacts_cookbook_identifier.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/chef_zero/endpoints/cookbook_artifacts_cookbook_identifier.rb b/lib/chef_zero/endpoints/cookbook_artifacts_cookbook_identifier.rb index cb6413e..4d22d08 100644 --- a/lib/chef_zero/endpoints/cookbook_artifacts_cookbook_identifier.rb +++ b/lib/chef_zero/endpoints/cookbook_artifacts_cookbook_identifier.rb @@ -2,7 +2,7 @@ require 'chef_zero/chef_data/data_normalizer' module ChefZero module Endpoints - class CookbookArtifactsCookbookIdentifierEndpoint < RestBase + class CookbookArtifactsCookbookIdentifierEndpoint < ChefZero::Endpoints::CookbookVersionEndpoint # these endpoints are almost, but not quite, not entirely unlike the corresponding /cookbooks endpoints. # it could all be refactored for maximum reuse, but they're short REST methods with well-defined # behavioral specs (pedant), so there's not a huge benefit. @@ -27,14 +27,12 @@ module ChefZero # DELETE /organizations/ORG/cookbook_artifacts/COOKBOOK/IDENTIFIER def delete(request) begin - identified_cookbook_data = normalize(request, parse_json(get_data(request))) + doomed_cookbook_json = get_data(request) + identified_cookbook_data = normalize(request, parse_json(doomed_cookbook_json)) delete_data(request) # go through the recipes and delete stuff in the file store. - identified_cookbook_data["recipes"].each do |r| - file_path = make_file_store_path(request.rest_path, r) - delete_data(request, file_path) - end + hoover_unused_checksums(get_checksums(doomed_cookbook_json), request, 'cookbook_artifacts') # if this was the last revision, delete the directory so future requests will 404, instead of # returning 200 with an empty list. |