knife-essentials icon indicating copy to clipboard operation
knife-essentials copied to clipboard

support roles and data bags inside cookbooks

Open schisamo opened this issue 13 years ago • 2 comments

If you are using a tool like Berkshelf in your cookbook development workflow it is common to store supporting roles and data_bags inside the cookbook's git repository.

For example, given a directory structure like this:

% tree -L 1 --dirsfirst .
.
├── attributes
├── bin
├── data_bags
├── files
├── providers
├── recipes
├── resources
├── templates
├── Berksfile
├── Berksfile.lock
├── Gemfile
├── Gemfile.lock
├── LICENSE
├── README.md
├── Thorfile
├── Vagrantfile
├── chefignore
└── metadata.rb

The following commands:

knife diff ./data_bags
knife diff data_bags
knife show ./data_bags
knife show data_bags

all fail with a variant of the error: ERROR: Attempt to use relative path './data_bags' when current directory is outside the repository path.

schisamo avatar Feb 14 '13 13:02 schisamo

Fascinating. Do they get uploaded as part of the cookbook too?

jkeiser avatar Feb 14 '13 15:02 jkeiser

Nope. They are stored in the git repo for the cookbook though. We maintain a whitelist of valid cookbooks segements: https://github.com/opscode/chef/blob/master/lib/chef/cookbook_version.rb#L43

Only directories in this segment list are uploaded to the server. All root files are though.

schisamo avatar Feb 14 '13 18:02 schisamo