-
Notifications
You must be signed in to change notification settings - Fork 213
Berkshelf & Librarian Chef integration
OK, here we go. The integration touches two commands: knife solo init
and knife solo cook
(which is also used internally by knife solo bootstrap
).
Currently knife solo init
defaults to --berkshelf
. Then if berkshelf gem is not installed but Berksfile exists, a warning is issued while cooking.
Rules to select the default action (first one that matches):
- If Berksfile or Cheffile is found, default to the corresponding option (prefer Berkshelf). We don't override existing files, so this might only write .chef/knife.rb (relates to #239).
- If berkshelf gem is found, default to
--berkshelf
. I.e. generate Berksfile etc. - If librarian-chef is found, default to
--librarian
. I.e. generate Cheffile etc. - Default to
--no-berkshelf --no-librarian
, but maybe display some information to promote the use of one or the other?
You can also turn these integrations off permanently by setting the following options in knife.rb
:
knife[:berkshelf] = false
knife[:librarian] = false
- Enabled by default
- Can be disabled with
--no-berkshelf
option orknife[:berkshelf] = false
configuration - Disabled if ./Berksfile is not found
- Disabled if "berkshelf" gem is not installed
- Installs/vendors the cookbooks to a directory whose path
- can be specified with
knife[:berkshelf_path]
(init
sets it to "cookbooks" to follow the convention of "cookbooks" vs. "site-cookbooks") - defaults to ~/.berkshelf/knife-solo/<hash>/, where <hash> is calculated from the absolute path of the kitchen
- can be specified with
- Adds the path automatically to
cookbook_path
array so it will be uploaded and configured to the node
- Enabled by default
- Can be disabled with
--no-librarian
option orknife[:librarian] = false
configuration - Disabled if ./Cheffile is not found
- Disabled if "librarian-chef" gem is not installed (or "librarian" gem v<0.1.0)
- Installs/vendors the cookbooks to a directory which is configured to Librarian (defaults to ./cookbooks)
- Adds the path automatically to
cookbook_path
array so it will be uploaded and configured to the node
--
Pretty simple, isn't it? ;)
One common problem seems to be that users have berkshelf or librarian-chef gem installed when they run knife solo init
which then creates Berksfile or Cheffile even if they do not plan using them. Then they put local cookbooks to ./cookbooks/ directory which gets nuked when knife solo cook
runs berks install
or librarian-chef install
. So it should be pointed out that local cookbooks should be put to ./site-cookbooks/ (or even better, to own repos which are pulled in by Berkshelf/Librarian).