Chef knife configuration

4.6k views Asked by At

I feel silly asking this question as it seems to work flawlessly for most people but I couldn't solve the following problem I encountered after setting up a Chef server 12 on RHEL 6 and the ChefDK 0.6.0 on my mac.

The chef server setup went through like charm as describeb on the documentation, no errors at all. When I wanted to use my machine as workstation to push cookbooks to the server I always get the error "The object you are looking for could not be found". According to other stackoverlfow posts (0, 1, 2) this is likely due to a configuration issue in knife.rb. Nevertheless, I used "knife configure" to setup the knife.rb file and double checked for any typos in the path. In addition, according to the knife.rb documentation page I used the attributes properly.

Anyone have an idea what could cause the problem?

log_level                :info
log_location             STDOUT
node_name                "nodermatt"
client_key               "/Users/odermatt/chef-repo/.chef/nodermatt.pem"
validation_client_name   "Adobe-validator.pem"
validation_key           "/Users/odermatt/chef-repo/.chef/Adobe-validator.pem"
chef_server_url          "https://sj1010005158157.corp.adobe.com:443/organizations/Adobe"
syntax_check_cache_path  "/Users/odermatt/chef-repo/.chef/syntax_check_cache"
cookbook_path [ "/Users/odermatt/chef-repo/cookbooks" ]
2

There are 2 answers

0
Kumaresh Babu N S On BEST ANSWER

You need to do perform knife commands under .chef directory. I too had same problem for change I tried under .chef directory, it was working. Try "knife client check" and "knife cookbook upload yourcookbook".

In knife.rb file, give chef_server_url as with your orgs name means which org you need to upload the cookbook. Typically be like "https://api.chef.io/organizations/orgname" and give path to your cookbooks directory.

1
Alex On

I had this same issue, could not run

knife node run_list add nodename 'recipe[cron-delvalidate::default]' - cron-delvalidator recipe to the node named: chefnode

I found out, after reading this that it's Chefnode, not chefnode, capital "C". This solved my issue.

The response was:

Chefnode:
  run_list: recipe[cron-delvalidate::default]