Ruby 厨师长是';t运行apt(apt获取更新)配方。Apt返回100

Ruby 厨师长是';t运行apt(apt获取更新)配方。Apt返回100,ruby,ubuntu-11.04,apt-get,chef-infra,chef-recipe,Ruby,Ubuntu 11.04,Apt Get,Chef Infra,Chef Recipe,在vagrant mac os x 10.7.2上运行Ubuntu11.04。正在运行chef服务器 尝试安装postgresql community chef recipe时,我出现以下错误,尽管我的基本角色看起来像这样(我添加了apt recipe以尝试更新apt get): 尝试进行厨师长跑步: $ vagrant reload db1dev [db1dev] Attempting graceful shutdown of linux... [db1dev] Preparing host

在vagrant mac os x 10.7.2上运行Ubuntu11.04。正在运行chef服务器

尝试安装postgresql community chef recipe时,我出现以下错误,尽管我的基本角色看起来像这样(我添加了apt recipe以尝试更新apt get):

尝试进行厨师长跑步:

$ vagrant reload db1dev
[db1dev] Attempting graceful shutdown of linux...
[db1dev] Preparing host only network...
[db1dev] Clearing any previously set forwarded ports...
[db1dev] Forwarding ports...
[db1dev] -- ssh: 22 => 2222 (adapter 1)
[db1dev] Cleaning previously set shared folders...
[db1dev] Creating shared folders metadata...
[db1dev] Running any VM customizations...
[db1dev] Booting VM...
[db1dev] Waiting for VM to boot. This can take a few minutes.
[db1dev] VM booted and ready for use!
[db1dev] Enabling host only network...
[db1dev] Mounting shared folders...
[db1dev] -- v-root: /vagrant
[db1dev] Running provisioner: Vagrant::Provisioners::ChefClient...
[db1dev] Creating folder to hold client key...
[db1dev] Uploading chef client validation key...
[db1dev] Generating chef JSON and uploading...
[db1dev] Running chef-client...
[db1dev] stdin: is not a tty
: stderr
[db1dev] [Thu, 19 Jan 2012 21:44:45 -0800] INFO: *** Chef 0.10.2 ***
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:46 -0800] INFO: Client key /etc/chef/client.pem is not present - registering
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:46 -0800] INFO: HTTP Request Returned 404 Not Found: Cannot load node dev-vagrant-db1-andres
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Setting the run_list to ["role[base]", "role[db_master]"] from JSON
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Run List is [role[base], role[db_master]]
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Run List expands to [base_server, vim, postgresql::server]
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Starting Chef Run for dev-vagrant-db1-andres
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Loading cookbooks [base_server, openssl, postgresql, vim]
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/resources/repository.rb from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/metadata.rb from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/providers/repository.rb from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/recipes/cacher.rb from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/recipes/cacher-client.rb from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/recipes/default.rb from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/metadata.json from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Removing cookbooks/apt/README.md from the cache; its cookbook is no longer needed on this client.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Storing updated cookbooks/base_server/recipes/default.rb in the cache.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Storing updated cookbooks/base_server/README.rdoc in the cache.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Storing updated cookbooks/base_server/metadata.rb in the cache.
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:47 -0800] INFO: Processing package[postgresql-client] action install (postgresql::client line 37)
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:48 -0800] ERROR: package[postgresql-client] (postgresql::client line 37) has had an error
[Thu, 19 Jan 2012 21:44:48 -0800] ERROR: Running exception handlers
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:48 -0800] FATAL: Saving node information to /srv/chef/file_store/failed-run-data.json
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:48 -0800] ERROR: Exception handlers complete
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:48 -0800] FATAL: Stacktrace dumped to /srv/chef/file_store/chef-stacktrace.out
: stdout
[db1dev] [Thu, 19 Jan 2012 21:44:48 -0800] FATAL: Chef::Exceptions::Exec: package[postgresql-client] (postgresql::client line 37) had an error: apt-get -q -y install postgresql-client=8.4.8-0ubuntu0.10.04 returned 100, expected 0
: stdout
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chef-client -c /etc/chef/client.rb -j /etc/chef/dna.json

The output of the command prior to failing is outputted below:

[no output]

如果我在服务器内部手动执行$sudo apt-get更新,那么再运行一次chef-client-install-postgres就不会有问题了。你知道为什么apt配方没有运行吗?(我也知道它没有运行,因为apt-get的时间戳文件不是在ubuntu中创建的)。任何帮助都将不胜感激。

因此,从您打印的错误来看,运行命令

apt-get -q -y install postgresql-client=8.4.8-0ubuntu0.10.04
这是失败的

但是你说如果你跑

apt-get update
首先,然后再重新规定,这样行吗

我的直觉是,当您第一次运行chef时,您请求的postgresql客户端版本不在您下载的apt包列表中,但运行
apt get update
会找到该版本

我看到您首先运行的是
base\u服务器
recipe,这是在列表中添加apt存储库吗


无论如何,我建议在运行postgres配方之前运行一个
apt get update
,我认为这可能是适合放入基本服务器配方的东西。

谢谢,这就是apt配方应该做的。问题是“即使apt配方应该这样做,为什么apt没有被更新”您是否使用基于的配方?如果是这样,这只是设置了从其他配方调用apt get update的功能(请注意第29行的注释),但在该配方运行时不运行调用,而是执行第33行的
操作:nothing
。可以在Ah中看到在配方运行后使用apt get update执行的示例,这是有意义的。谢谢您总是可以执行“apt get update”。默认情况下,chef中的
execute
命令将立即运行
apt-get update