Search code examples
ruby-on-railschef-infrachef-soloknife

Set up Chef 11 and workstation. Knife suddenly creating cookbooks improperly, not finding knife.rb


I set up Chef 11 and configured knife on a workstation. Everything was working the last time I logged in and I successfully created several cookbooks and synced them to the Chef server.

Now, all of a sudden when I create a cookbook ("WARNING: No knife configuration file found"):

root@server1:/# knife cookbook create postsetup
WARNING: No knife configuration file found
** Creating cookbook postsetup
** Creating README for cookbook: postsetup
** Creating CHANGELOG for cookbook: postsetup
** Creating metadata for cookbook: postsetup

This results in the cookbook being created in the default location. It is as if knife is suddenly ignoring the knife.rb:

root@server1:/# find -iname "*postsetup*"
./var/chef/cookbooks/postsetup

Knife.rb file (The only knife.rb file. Problem still happens even after doing a fresh 'knife configure'):

log_level                :info
log_location             STDOUT
node_name                'workstation'
client_key               '/root/chef-repo/.chef/workstation.pem'
validation_client_name   'chef-validator'
validation_key           '/root/chef-repo/.chef/chef-validator.pem'
chef_server_url          'https://xxx.xxx.xxx.xxx:443'
syntax_check_cache_path  '/root/chef-repo/.chef/syntax_check_cache'
cookbook_path [ '/root/chef-repo/cookbooks' ]

What is going on with the knife utility?


Solution

  • This was resolved by moving my knife.rb and pertinent files to /root/.chef. It appears knife now only wants to look in this location, despite fiddling with some of the parameters. :)