chef-cli
chef-cli copied to clipboard
Failure to update a specific Policy's cookbook when cookbooks cache is outdated
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:
- Setup a Policyfile with at least one not-up-to-date cookbook
- Install the policy -
chef-cli install - Clear your cookbooks cache -
rm -rf ~/.chef-workstation/cache/cookbooks/ - Update the outdated cookbook using the
--exclude_depsoption --chef-cli update Policyfile.rb --exclude-deps <the_cookbook>
I personally reproduce it easily with yum-epel 4.0, here are:
- the Policyfile.rb
- the Policyfile.lock.json
- the command line outputs
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 locationyum-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