Chef workstation is unable to find knife.rb unless in "chef-repo" -


  1. when run knife node list while in /home/ec2-user complains

    "warning: no knife configuration file found
    error: private key not loaded /etc/chef/client.pem check configuration file , ensure private key readable"

  2. when run knife node list while in /home/ec2-user/chef-repo executes successfully
    chef-repo directory contains .chef/knife.rb

my knife.rb located in /home/ec2-user/chef-repo/.chef/knife.rb

my knife.rb contents:

log_level                :info log_location             stdout node_name                'admin' client_key               '/home/ec2-user/chef-repo/.chef/admin.pem' validation_client_name   'chef-validator' validation_key           '/home/ec2-user/chef-repo/.chef/chef-validator.pem' chef_server_url          'https://xx.xx.xx.xx:443' syntax_check_cache_path  '/home/ec2-user/chef-repo/.chef/syntax_check_cache' cookbook_path [ '~/chef-repo/cookbooks/cookbooks' ] 

if want have "global per-user" config, either set knife_home environment variable .chef directory or copy/symlink knife.rb /home/ec2-user/.chef/knife.rb

specification: https://github.com/chef/chef/blob/master/spec/unit/workstation_config_loader_spec.rb#l51

implementation: https://github.com/chef/chef/blob/master/lib/chef/workstation_config_loader.rb#l97-l124


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -