Chef infra 安装postgresql之前未运行apt get更新

Chef infra 安装postgresql之前未运行apt get更新,chef-infra,vagrant,Chef Infra,Vagrant,我正在使用vagrant创建一个运行在Ubuntu10.04上的postgresql实例,使用opscode cookbooks,但是由于某种原因,在postgresql运行之前没有调用apt get update,因此apt get install postgresql命令失败,出现404错误。有人能帮厨师新手吗?我已经看完了其余的答案,但似乎什么都不管用 STDOUT: Reading package lists... Building dependency tree... Reading

我正在使用vagrant创建一个运行在Ubuntu10.04上的postgresql实例,使用opscode cookbooks,但是由于某种原因,在postgresql运行之前没有调用
apt get update
,因此
apt get install postgresql
命令失败,出现404错误。有人能帮厨师新手吗?我已经看完了其余的答案,但似乎什么都不管用

STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libpq5 postgresql-client postgresql-client-8.4 postgresql-client-common
Suggested packages:
  postgresql-8.4 postgresql-doc-8.4
The following NEW packages will be installed:
  libpq5 postgresql-client postgresql-client-8.4 postgresql-client-common
0 upgraded, 4 newly installed, 0 to remove and 52 not upgraded.
Need to get 941kB of archives.
After this operation, 5,300kB of additional disk space will be used.
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libpq5 8.4.6-0ubuntu10.04
  404  Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main postgresql-client-common 106ubuntu1
  404  Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main postgresql-client-8.4 8.4.6-0ubuntu10.04
  404  Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main postgresql-client 8.4.6-0ubuntu10.04
  404  Not Found [IP: 91.189.91.13 80]STDERR: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/postgresql-8.4/libpq5_8.4.6-0ubuntu10.04_i386.deb  404  Not Found [IP: 91.189.91.13 80]

Chef默认情况下永远不会运行
apt get update
。你必须明确地告诉它这样做

我建议你:

  • 在安装
    postgresql
    之前,利用Opscode的
    apt
    cookbook并调用
    include_recipe“apt::default”
    ;或

  • 在您的
    Vagrant文件中的Chef之前添加shell provisioner

    
    config.vm.provision:shell,:inline=>'apt get update'
    

第一个将在您应用cookbook的任何地方运行,第二个将在每次设置Vagrant VM时运行更新,但如果您在其他地方使用cookbook,则不会强制更新