support roles and data bags inside cookbooks
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.
Fascinating. Do they get uploaded as part of the cookbook too?
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.