Hi,
I’m trying to setup knife but I run in a ‘cannot read .pem file’
The first thing I’m trying to do is to get a API Key for knife:
gilles:.chef gilles$ knife client create gilles -f ~/.chef/gilles.pem -l debug
ERROR: Failed to read the private key /Users/gilles/.chef/gilles.pem:
#<Errno::ENOENT: No such file or directory -
/Users/gilles/.chef/gilles.pem>,
/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/rest.rb:60:in
read'/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/rest.rb:60:in
load_signing_key’/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/rest.rb:49:in
initialize'/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/api_client.rb:231:in
new’/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/api_client.rb:231:in
save'/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/knife/client_create.rb:47:in
run’/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/application/knife.rb:110:in
run'/Library/Ruby/Gems/1.8/gems/chef-0.8.4/bin/knife:26/usr/bin/knife:19:in
load’/usr/bin/knife:19
/Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/rest.rb:63:in
load_signing_key': I cannot read /Users/gilles/.chef/gilles.pem, which you told me to use to sign requests! (Chef::Exceptions::PrivateKeyMissing) from /Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/rest.rb:49:in
initialize’
from /Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/api_client.rb:231:in
new' from /Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/api_client.rb:231:in
save’
from /Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/knife/client_create.rb:47:in
run' from /Library/Ruby/Gems/1.8/gems/chef-0.8.4/lib/chef/application/knife.rb:110:in
run’
from /Library/Ruby/Gems/1.8/gems/chef-0.8.4/bin/knife:26
from /usr/bin/knife:19:in `load’
from /usr/bin/knife:19
The command is prompting me with
{
“public_key”: null,
“name”: “gilles”,
“json_class”: “Chef::ApiClient”,
“admin”: false,
“chef_type”: “client”
}
-> I don’t really know what to set here, I tried different input for
public_key with the same result.
This is my knife.rb file
log_level :info
log_location STDOUT
node_name 'gilles’
client_key '/Users/gilles/.chef/gilles.pem’
validation_client_name 'chef-validator’
validation_key '/Users/gilles/.chef/validation.pem’
chef_server_url ‘http://chefserver:4000’
cache_type ‘BasicFile’
cache_options( :path => ‘/Users/gilles/.chef/checksums’ )
cookbook_path [ ‘/Users/gilles/Sites/chef/cookbooks’,
’/Users/gilles/Sites/chef/site-cookbooks’ ]
the validation key is the one created during chef-server install and I
can register chef-clients without problems.
chef rubygem is 0.8.4
Do I need to setup the dev box as a chef-client for knife to work?
Any other idea?
Thanks
–Gilles