Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle cookbook_version being Nil #55

Open
mbaitelman opened this issue Jan 7, 2020 · 1 comment
Open

Handle cookbook_version being Nil #55

mbaitelman opened this issue Jan 7, 2020 · 1 comment
Labels
Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected.

Comments

@mbaitelman
Copy link
Contributor

Version:

All versions of Chef CLI

Environment:

Tested in Docker

Scenario:

Run chef install (which resolves to chef-cli install) on a policyfile that has a cookbook dependency with missing information

Steps to Reproduce:

I can reproduce this each time on my repo though I do not know which of my cookbooks/dependencies are causing it

Expected Result:

Policyfile.lock should be generated

Actual Result:

Caching Cookbooks...
Error: Failed to generate Policyfile.lock
Reason: (NoMethodError) undefined method `metadata' for nil:NilClass
@mbaitelman mbaitelman added the Status: Untriaged An issue that has yet to be triaged. label Jan 7, 2020
@afiune afiune added Triage: Confirmed Indicates and issue has been confirmed as described. Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected. and removed Status: Untriaged An issue that has yet to be triaged. Triage: Confirmed Indicates and issue has been confirmed as described. labels Jan 29, 2020
@afiune
Copy link

afiune commented Jan 29, 2020

@mbaitelman thank you for filling this issue, also, thank you for your PR to add more logging info for troubleshooting. We are trying to reproduce this failure and we need more information from you to continue doing some troubleshooting:

  1. Are you running on the latest version of Chef Workstation (chef -v)
  2. Have you found the root cause of the issue? (From your PR it sounds like it is a Policyfile with a cookbook dependency that has no version on the metadata but we weren't able to replicate it that way)

After creating a Policyfile.rb with a cookbook dependency to bar cookbook that has no version on its metadata.rb, we have the following output of the chef install command:

➜  workspace chef install
Building policy example-application-service
Expanded run list: recipe[example_cookbook::default]
Caching Cookbooks...
Installing bar >= 0.0.0 from path
Using      example_cookbook 0.1.0

Lockfile written to /Users/afiune/chef/workspace/Policyfile.lock.json
Policy revision id: 5276887333b8f5c8d9a521888cda0538511f779b25c4ef30e7a41ebf4b3a5862

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants