chef / chef/chef-server

500 error when attempting to GET a cookbook artifact ACL for invalid artifact

Open
#2,405 0 comments 0 reactions 1 assignee View on GitHub

@lbakerchef is already working on this.

Since Dec 21, 2021.

Triage: Confirmed
Dominant language
Erlang
Stars
303
Forks
211
Avg merge
1d 8h
Merged PRs (30d)
5

Description

This is easily reproduceable against current hosted chef:

$ bin/knife raw cookbook_artifacts/bad_artifact
ERROR: Server responded with error 404 "Object Not Found"
ERROR: Error Body: {"error":["not_found"]}
?1 chef/knife $ bin/knife raw cookbook_artifacts/bad_artifact/_acl
ERROR: Server returned error 500 for https://api.chef.io/organizations/jiminywarehouse/cookbook_artifacts/bad_artifact/_acl, retrying 1/5 in 4s

The fix for this is to add a handler to chef_wm_util:not_found_message, as

chef_wm_util:not_found_message(cookbook_artifact, Name)

The dialyzer spec must also be updated to indicated cookbook_artifact is an accepted input. It is worth looking too to see why dialyzer didn't warn/error about this function being called with non-matching input - maybe something in the existing rule is too general and needs to be tightened up.

https://github.com/chef/chef-server/blob/dbc44702778cf74a833d738ef1a9e0de12e14b93/src/oc_erchef/apps/oc_chef_wm/src/chef_wm_util.erl#L114-L163

Aha! Link: https://chef.aha.io/features/SH-3015

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.