2012-07-10 6 views
5

Tengo una VM que está hecha con vagabundo y chef. Anoche mi computadora se reinició inesperadamente mientras la máquina virtual estaba funcionando. Después de eso, cuando intento vagabundear en la VM obtengo: ¡El chef nunca se completó con éxito! Cualquier error debería ser visible en el resultado anterior. Por favor, arregle sus recetas para que se completen correctamente.problema de vagabundo

[default] VM already created. Booting if it's not already running... 
[default] Clearing any previously set forwarded ports... 
[default] Forwarding ports... 
[default] -- 22 => 2222 (adapter 1) 
[default] Creating shared folders metadata... 
[default] Clearing any previously set network interfaces... 
[default] Preparing network interfaces based on configuration... 
[default] Running any VM customizations... 
[default] Booting VM... 
[default] Waiting for VM to boot. This can take a few minutes. 
[default] VM booted and ready for use! 
[default] Configuring and enabling network interfaces... 
[default] Mounting shared folders... 
[default] -- v-root: /vagrant 
[default] -- v-data: /vagrant 
[default] -- v-csr-2: /tmp/vagrant-chef-1/chef-solo-2/roles 
[default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks 
[default] Running provisioner: Vagrant::Provisioners::ChefSolo... 
[default] Generating chef JSON and uploading... 
[default] Running chef-solo... 
stdin: is not a tty 
[Tue, 10 Jul 2012 00:59:36 -0700] INFO: *** Chef 0.10.2 *** 
[Tue, 10 Jul 2012 00:59:36 -0700] INFO: Setting the run_list to ["role[my-site]"] from JSON 
[Tue, 10 Jul 2012 00:59:36 -0700] INFO: Run List is [role[my-site]] 
[Tue, 10 Jul 2012 00:59:36 -0700] INFO: Run List expands to [memcached, my-site, my-site::vm] 
[Tue, 10 Jul 2012 00:59:36 -0700] INFO: Starting Chef Run for lucid32 
[Tue, 10 Jul 2012 00:59:37 -0700] ERROR: Running exception handlers 
[Tue, 10 Jul 2012 00:59:37 -0700] ERROR: Exception handlers complete 
[Tue, 10 Jul 2012 00:59:37 -0700] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out 
[Tue, 10 Jul 2012 00:59:37 -0700] FATAL: NoMethodError: undefined method `[]' for nil:NilClass 
Chef never successfully completed! Any errors should be visible in the 
output above. Please fix your recipes so that they properly complete. 

Más tarde editar:

StackTrace vuelca en /tmp/vagrant-chef-1/chef-stacktrace.out

Generated at Tue Jul 10 00:59:37 -0700 2012 
NoMethodError: undefined method `[]' for nil:NilClass 
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/my-site/recipes/default.rb:114:in `from_file' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:69:in `instance_eval' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:69:in `method_missing' 
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/my-site/recipes/default.rb:109:in `from_file' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/cookbook_version.rb:578:in `load_recipe' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:40:in `include_recipe' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `each' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:72:in `load' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:69:in `each' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/run_context.rb:69:in `load' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/client.rb:195:in `setup_run_context' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/client.rb:159:in `run' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:192:in `run_application' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `loop' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `run_application' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application.rb:66:in `run' 
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/chef-solo:25 
/opt/ruby/bin/chef-solo:19:in `load' 
/opt/ruby/bin/chef-solo:19 

Cualquier pensamiento,

Gracias, Radu

+0

¿Cómo es el stacktrace en '/ tmp/vagrant-chef-1/chef-stacktrace.out'? –

+0

lo agregó como edición posterior – Radu

+0

¿Se ejecutó el Chef previamente completo sin errores? En la línea 114 de 'my-site/recipes/default.rb', probablemente esté accediendo a algún atributo de nodo que no existe. Echa un vistazo a esa línea de código, ¿reconoces qué objeto es nulo y puedes hacerlo para que no sea nulo? –

Respuesta

6

Esto es un error en la receta de su Chef. Si lee la pila, puede ver que el error está realmente en la línea 114 de la receta predeterminada en el libro de cocina my-site. El error de Ruby que está viendo significa que está intentando hacer algo como a[:foo] donde a es nil. Por supuesto, no puede llamar al [] en nil.

2

Tuve el mismo problema. Descubrí que la versión del chef que se estaba ejecutando en mi VM era demasiado antigua (0.10.10).

Tienes que actualizarlo:

 
local$ vagrant ssh 
vagrant$ gem install chef 

y vuelva a intentarlo.

+1

Ejecutar como root/con sudo. Como vagabundo de usuario, obtiene este error: "No tiene permisos de escritura en el directorio /opt/vagrant_ruby/lib/ruby/gems/1.8" – Henk

0

que recibieron los errores:

Chef never successfully completed! Any errors should be visible in the 
output above. Please fix your recipes so that they properly complete. 

Error executing action `create` on resource 'mysql_service[default]' 

He utilizado el:

local$ vagrant ssh 
vagrant$ gem install chef 

Después de volver a intentarlo, todo salió perfecto.

Cuestiones relacionadas