2012-01-20 14 views
5

Ejecutando Ubuntu 11.04 en vagabundo, mac os x 10.7.2. Ejecutando el servidor del chef.Chef no está ejecutando la receta apt (apt-get update). Apt devuelve 100

Tratando de instalar la receta del cocinero de la comunidad PostgreSQL, me sale el siguiente error, a pesar de que mi papel de base se ve algo como esto (he añadido la receta apta para tratar de actualizar apt-get):

name "base" 
description "The base role for systems" 
run_list(
     "recipe[apt]", 
     "recipe[vim]" 
) 

tratando de hacer una carrera de cocinero:

$ 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] 

Si lo hago manualmente un $ sudo apt-get update desde el interior del servidor, haciendo otra carrera de cocinero y cliente instalar postgres sin ningún problema. ¿Alguna idea sobre por qué la receta apt no se está ejecutando? (También sé que no se está ejecutando porque el archivo de marca de tiempo para apt-get no se creó en ubuntu). Cualquier ayuda sería muy apreciada.

Respuesta

6

Así, a partir del error que ha imprimido, parece que la ejecución del comando

apt-get -q -y install postgresql-client=8.4.8-0ubuntu0.10.04 

está fallando.

Pero usted dijo que si se ejecuta

apt-get update 

En primer lugar, y luego volver a la prestación, que funciona bien?

Mi corazonada es que la primera vez que ejecuta el chef, la versión del cliente postgresql que está solicitando no está en su lista descargada de paquetes apt, pero al ejecutar el apt-get update encuentra esa versión.

Veo que está ejecutando una receta base_server primero, ¿eso es agregar repositorios apt a la lista?

Independientemente, recomendaría ejecutar un apt-get update antes de ejecutar la receta postgres, esto es algo que probablemente sería apropiado poner en la receta base_server, creo.

+5

Gracias, eso es lo que debe hacer la receta apt. La pregunta es "¿por qué no se puede actualizar a pesar de que se supone que la receta de apt está haciendo eso?" – Andres

+0

¿Está utilizando la receta basada en https://github.com/opscode/cookbooks/blob/master/apt/ recetas/default.rb? Si es así, eso solo establece la capacidad de llamar a apt-get-update desde OTRAS recetas (observe el comentario en la línea 29), pero no ejecuta la llamada cuando esta receta se ejecuta en 'acción: nada' en la línea 33. –

+2

Un ejemplo del uso de la ejecución de la actualización apt-get después de ejecutar una receta se puede ver en https://github.com/opscode/cookbooks/blob/master/rsyslog/recipes/default.rb#L28 –

Cuestiones relacionadas