/usr/lib/ruby/vendor_ruby/chef_zero/endpoints/cookbook_artifact_endpoint.rb is in chef-zero 4.5.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | require 'chef_zero/chef_data/data_normalizer'
module ChefZero
module Endpoints
class CookbookArtifactEndpoint < RestBase
# GET /organizations/ORG/cookbook_artifacts/COOKBOOK
def get(request)
cookbook_name = request.rest_path.last
cookbook_url = build_uri(request.base_uri, request.rest_path)
response_data = {}
versions = []
list_data(request).each do |identifier|
artifact_url = build_uri(request.base_uri, request.rest_path + [cookbook_name, identifier])
versions << { url: artifact_url, identifier: identifier }
end
response_data[cookbook_name] = { url: cookbook_url, versions: versions }
return json_response(200, response_data)
end
end
end
end
|