[chef] Fail to connect to chef server when using vagrant


Chronological Thread 
  • From: < >
  • To:
  • Subject: [chef] Fail to connect to chef server when using vagrant
  • Date: Wed, 9 Apr 2014 10:53:17 -0700 (PDT)

I can successfully run any knife command I wish (i.e. authenticates with the
chef server, returns information).  

Knife reads my knife_override.rb properly, which is necessary because my
username on my box is different from my key name (see below)

knife.rb:

node_name               ( ENV['USER'] || ENV['USERNAME'] ).downcase
client_key              "#{home_dir}/.chef/#{node_name}.pem"

My username on my box is 'knox', which means that WITHOUT the knife_override 
my
client key would be 'knox.pem', which it is not.  My knife override (see 
below)
has the correct key in it 'klively.pem'

knife_override.rb:

node_name             'klively'
client_key               '/Users/Knox/.chef/klively.pem'

Like I said, when I run knife commands it works just as it should.  It reads 
my
knife_overide.rb correctly, returns data from the chef server.  However, when
using Vagrant (i.e. issuing the 'vagrant up' command) it runs through the
recipe fine until Ridley tries to establish a connection with my chef server. 
It then fails to authenticate.  It seems as if it is not reading my
knife_override.rb because it is trying to use 'knox.pem' [which doesn't exist]
instead of 'klively.pem'.  Which is odd...it was my believe it is the same API
being used for this connection.  Hence why I came here.


Output from issuing 'vagrant up':

Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[Berkshelf] Uploading cookbooks to 'https://archive1.namimedia.com'
[Berkshelf] Using nami-users (0.4.8) at '../nami-users'
[Berkshelf] Using base (0.8.3) from metadata
[Berkshelf] Using users (1.5.2)
[Berkshelf] Using cpan (0.0.29)
[Berkshelf] Using mysql (5.1.0)
[Berkshelf] Using couchbase (1.1.0)
[Berkshelf] Using apt (2.3.8)
[Berkshelf] Using openssl (1.1.0)
[Berkshelf] Using windows (1.30.2)
[Berkshelf] Using chef_handler (1.1.5)
[Berkshelf] Using yum (3.0.6)
[Berkshelf] Using build-essential (1.4.4)
[Berkshelf] Using apache2 (1.8.14)
Ridley::Client crashed!
Ridley::Errors::ClientKeyFileNotFoundOrInvalid: client key is invalid or not
found at: '/Users/Knox/.chef/knox.pem'
       
/Users/Knox/.vagrant.d/gems/gems/ridley-1.5.3/lib/ridley/client.rb:156:in
`initialize'
       
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in
`public_send'
       
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in
`dispatch'
       
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67:in
`dispatch'
       
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:326:in
`block in handle_message'
       
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:42:in
`block in initialize'
       
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11:in
`block in create'
Ridley::Errors::ClientKeyFileNotFoundOrInvalid: client key is invalid or not
found at: '/Users/Knox/.chef/knox.pem'
/Users/Knox/.vagrant.d/gems/gems/ridley-1.5.3/lib/ridley/client.rb:156:in
`initialize'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in
`public_send'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in
`dispatch'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67:in
`dispatch'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:326:in
`block in handle_message'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:42:in
`block in initialize'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11:in
`block in create'
(celluloid):0:in `remote procedure call'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/calls.rb:95:in
`value'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/proxies/sync_proxy.rb:28:in
`method_missing'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/legacy.rb:14:in
`method_missing'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/proxies/actor_proxy.rb:25:in
`_send_'
/Users/Knox/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid.rb:129:in 
`new'
/Users/Knox/.vagrant.d/gems/gems/ridley-1.5.3/lib/ridley.rb:27:in `new'
/Users/Knox/.vagrant.d/gems/gems/berkshelf-2.0.14/lib/berkshelf/berksfile.rb:706:in
`ridley_connection'
/Users/Knox/.vagrant.d/gems/gems/berkshelf-2.0.14/lib/berkshelf/berksfile.rb:526:in
`upload'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/upload.rb:35:in
`block in upload'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/upload.rb:33:in
`each'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/upload.rb:33:in
`upload'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/upload.rb:22:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/install.rb:33:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Users/Knox/.vagrant.d/gems/gems/vagrant-omnibus-1.3.1/lib/vagrant-omnibus/action/install_chef.rb:38:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/provision.rb:54:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/providers/virtualbox/action/clear_forwarded_ports.rb:13:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/providers/virtualbox/action/set_name.rb:19:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/providers/virtualbox/action/clean_machine_folder.rb:17:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/providers/virtualbox/action/check_accessible.rb:18:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`block in run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in
`busy'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/call.rb:51:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`block in run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in
`busy'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/call.rb:51:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`block in run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in
`busy'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/call.rb:51:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/config_validate.rb:25:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/call.rb:57:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/config_validate.rb:25:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/configure_chef.rb:23:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/load_shelf.rb:28:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Users/Knox/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/set_ui.rb:12:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/env_set.rb:19:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builtin/call.rb:57:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:34:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builder.rb:116:in
`call'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`block in run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in
`busy'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in
`run'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/machine.rb:147:in
`action'
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/batch_action.rb:63:in
`block (2 levels) in run'
/Users/Knox/.vagrant.d/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in
`call'
/Users/Knox/.vagrant.d/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in
`block in create_with_logging_context'
Berkshelf::ChefConnectionError: There was an error connecting to the Chef
Server



Archive powered by MHonArc 2.6.16.

§