I am a chef Newbie and facing an issue.
Every time I run any of the knife cookbook command, I have to explicitly provide the path to cookbook using -o /path/to/cookbook
else it will error out saying no cookbooks found. Please find below commands:
$ knife cookbook upload getting-started ERROR: Could not find cookbook getting-started in your cookbook path, skipping it ERROR: Failed to upload 1 cookbook. $ knife cookbook upload getting-started -o /home/chefuser/chef11/chef-repo/cookbooks/ Uploading getting-started [0.4.0] Uploaded 1 cookbook.
Question:
I want to know/list the default search path for cookbooks and need to know how to modify it.
Also, why it is not looking at cookbook path and I have to provide it explicitly?
Thanks.
It is stored in bookshelf directory , which can be modified and the files regarding the cookbook are located at /var/opt/chef-server/bookshelf/data/bookshelf . In that directory u can find all the cookbooks uploaded and also you can view the recipes .
To upload a specific cookbook, go to the chef-repo directory, specify the cookbook name along with the cookbook directory as shown below. This will upload prod-db cookbook from local machine to the Chef Server. Please note that this will do the upload only if anything is changed in the cookbook locally.
You can just delete the folder that was created, however you'd like. For example, rm -rf site-cookbooks/ruby .
Default cookbook path could be set in ~/.chef/knife.rb
:
... cookbook_path [ '~/cookbooks/', '~/base-cookbooks/'] ...
Also, you could find knife.rb documentation useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With