chef-cli icon indicating copy to clipboard operation
chef-cli copied to clipboard

Failure to update a specific Policy's cookbook when cookbooks cache is outdated

Open Annih opened this issue 3 years ago • 0 comments

Version:

2.0.10

Environment:

  • ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]
  • rbenv 1.2.0-14-gc6cc0a1

Scenario:

Update a specific cookbook from a policy, without updating its deps, when the cookbooks cache is outdated.

Steps to Reproduce:

  1. Setup a Policyfile with at least one not-up-to-date cookbook
  2. Install the policy - chef-cli install
  3. Clear your cookbooks cache - rm -rf ~/.chef-workstation/cache/cookbooks/
  4. Update the outdated cookbook using the --exclude_deps option -- chef-cli update Policyfile.rb --exclude-deps <the_cookbook>

I personally reproduce it easily with yum-epel 4.0, here are:

Expected Result:

✅Exit code 0 ✅No error message ✅Cookbook updated in the Policyfile.lock.json

Actual Result:

❎Exit code 1 ❎Error message is printed:

Lockfile written to Policyfile.lock.json Error: Failed to generate Policyfile.lock Reason: (ChefCLI::CachedCookbookNotFound) Cookbook yum-epel' not found at expected cache location yum-epel-4.0.0-supermarket.chef.io' (full path: `<HOME>/.chef-workstation/cache/cookbooks/yum-epel-4.0.0-supermarket.chef.io')

✅Fun thing Policyfile.lock.json has been written before the error and the cookbook is properly updated

Annih avatar Jun 19 '22 21:06 Annih