chef, Could not find cookbook in your cookbook path

£可爱£侵袭症+ 提交于 2019-12-11 15:08:50

问题


in my chef-repo I added a cookbook

cookbooks/mycookbook

when i do

$ knife cookbook upload mycookbook 

I get

ERROR: Could not find cookbook php-1.3.1 in your cookbook path, skipping it
Uploaded 0 cookbooks.

What did I do wrong here


回答1:


A config.rb file is used to specify configuration details for knife, which is loaded every time the knife executable is run and is located by default at ~/.chef/config.rb (and if i am not mistaken, you can also place it within the your chef repository directory at .chef/config.rb).

make sure that you set cookbook_path in config.rb

cookbook_path

The Chef Infra Client sub-directory for storing cookbooks. This value can be a string or an array of file system locations, processed in the specified order. The last cookbook is considered to override local modifications. For example:

cookbook_path [
  '/var/chef/cookbooks',
  '/var/chef/site-cookbooks'
]



回答2:


To re-iterate on this answer, not only do you have to configure your cookbook location in your knife/config.rb file, you also have to make sure that your dependencies are present in the cookbooks folders.

For instance your error message is about a specific version of php. To make sure the php cookbook gets uploaded alongside your cookbook, you could run the following commands while inside your cookbook folder :

berks install
berks upload

This will ensure that all dependent cookbooks are uploaded alongside your main one. See example here :



来源:https://stackoverflow.com/questions/57777081/chef-could-not-find-cookbook-in-your-cookbook-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!