Chef infra 游民问题

Chef infra 游民问题,chef-infra,vagrant,Chef Infra,Vagrant,我有一个虚拟机,是由流浪汉和厨师。昨晚,当虚拟机启动并运行时,我的计算机意外重启。之后,当我尝试在虚拟机上漫游时,我得到: 厨师从未成功完成!任何错误都应该在上面的输出中可见。请修改您的食谱,以便正确完成。 [default] VM already created. Booting if it's not already running... [default] Clearing any previously set forwarded ports... [default] Forwarding

我有一个虚拟机,是由流浪汉和厨师。昨晚,当虚拟机启动并运行时,我的计算机意外重启。之后,当我尝试在虚拟机上漫游时,我得到: 厨师从未成功完成!任何错误都应该在上面的输出中可见。请修改您的食谱,以便正确完成。

[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.
以后编辑:

Stacktrace转储到/tmp/vagrant-chef-1/chef-Stacktrace.out

任何想法

谢谢,
Radu

这是厨师食谱中的一个错误。如果您阅读stacktrace,您可以看到错误实际上出现在
my site
cookbook中默认配方的第114行。您看到的Ruby错误意味着您试图执行类似于
a[:foo]
的操作,其中
a
nil
。当然,你不能在
nil
上调用
[]
,我也有同样的问题。我发现在我的虚拟机中运行的chef版本太旧了(0.10.10)

您必须更新它:

local$ vagrant ssh vagrant$ gem install chef 本地$vagrant ssh 流浪者$gem安装厨师
然后重试。

我收到了错误:

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]'
我使用了:

local$ vagrant ssh
vagrant$ gem install chef

再试一次后,一切都很顺利

/tmp/vagrant-chef-1/chef stacktrace.out
中的stacktrace是什么样子的?在以后的编辑中添加了它厨师以前运行时没有错误吗?在我的站点/recipes/default.rb的第114行中,您可能正在访问某个不存在的节点属性。看看那一行代码,你能识别出哪一个对象是nil吗?你能把它设置成不是nil吗?在意外重启之前,它工作正常…以root/与sudo一起运行。作为用户vagrant,您会遇到以下错误:“您没有写入/opt/vagrant\u ruby/lib/ruby/gems/1.8目录的权限”
local$ vagrant ssh
vagrant$ gem install chef