chef / chef/chef-cli

'chef generate recipe' doesn't use cookbook name in metadata.rb file

Open
#99 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Aspect: Stability Triage: Confirmed
Dominant language
Ruby
Stars
18
Forks
23
Avg merge
5d 17h
Merged PRs (30d)
1

Description

Version:

Chef Development Kit Version: 0.6.2
chef-client version: 12.3.0
berks version: 3.2.4
kitchen version: 1.4.0

Environment:

mac osx 10.10.4

Scenario:

Add a recipe using chef generate recipe. Breaks when git repo(cookbook dir) name is not same as cookbook name. I want to name my git repo differently than the cookbook name.

Steps to Reproduce:

chef generate cookbook foo
mv foo cookbook-foo
cd cookbook-foo
chef generate recipe bar

Expected Result:

rspec and kitchen to run successfully.

Actual Result:

I only included rspec output. kitchen has similar problem finding cookbook.

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: cookbook-foo

Expanded Run List:
------------------
* cookbook-foo::bar

F.

Failures:

  1) cookbook-foo::bar When all attributes are default, on an unspecified platfo
rm converges successfully                                                      
     Failure/Error: runner.converge(described_recipe)
     Net::HTTPServerException:
       412 "Precondition Failed "
     # ./spec/unit/recipes/bar_spec.rb:13:in `block (3 levels) in <top (required
)>'                                                                            
     # ./spec/unit/recipes/bar_spec.rb:17:in `block (3 levels) in <top (required
)>'                                                                            

Finished in 3.37 seconds (files took 3.72 seconds to load)
2 examples, 1 failure

Failed examples:

rspec ./spec/unit/recipes/bar_spec.rb:16 # cookbook-foo::bar When all attributes
 are default, on an unspecified platform converges successfully                

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.

Research direction

Start with the chef generate cookbook and chef generate recipe workflow, then inspect the generated metadata.rb and the failing spec/unit/recipes/bar_spec.rb setup. Reproduce the commands after renaming the cookbook directory, and consider the issue done when RSpec and Kitchen no longer resolve the repository name as the cookbook name.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.