Chef - notifica vários pacotes

1

Estou tentando implantar o postgresql 9.4 no CentOS 7

package ['postgresql94-server', 'postgresql94-contrib'] do
    action :nothing
end

execute "yum check-update" do
    command "yum check-update"
    action :nothing
end

package 'Install Postgres Repo' do
    package_name 'pgdg-redhat94'
    source '/tmp/pgdg-redhat94-9.4-2.noarch.rpm'
    notifies :run, 'execute[yum check-update]', :immediately
    notifies :install, 'package[postgresql94-server, postgresql94-contrib]', :immediately
    action :nothing
end

execute 'Download Postgres repo RPM' do
    command 'curl http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-redhat94-9.4-2.noarch.rpm -o /tmp/pgdg-redhat94-9.4-2.noarch.rpm'
    notifies :install, 'package[Install Postgres Repo]', :immediately
end

Estou recebendo o seguinte erro:

[root@db01 ~]# chef-client 
Starting Chef Client, version 12.6.0
resolving cookbooks for run list: ["postgres94"]
Synchronizing Cookbooks:
  - postgres94 (0.1.0)
Compiling Cookbooks...
Converging 4 resources

Running handlers:
[2015-12-30T15:32:16+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-12-30T15:32:16+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2015-12-30T15:32:16+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-12-30T15:32:16+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2015-12-30T15:32:16+00:00] ERROR: resource yum_package[Install Postgres Repo] is configured to notify resource package[postgresql94-server, postgresql94-contrib] with action install, but package[postgresql94-server, postgresql94-contrib] cannot be found in the resource collection. yum_package[Install Postgres Repo] is defined in /var/chef/cache/cookbooks/postgres94/recipes/default.rb:19:in 'from_file'

[2015-12-30T15:32:16+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[root@db01 ~]# chef-client 
Starting Chef Client, version 12.6.0
resolving cookbooks for run list: ["postgres94"]
Synchronizing Cookbooks:
  - postgres94 (0.1.0)
Compiling Cookbooks...
Converging 4 resources

Running handlers:
[2015-12-30T15:32:30+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-12-30T15:32:30+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2015-12-30T15:32:30+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-12-30T15:32:30+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2015-12-30T15:32:30+00:00] ERROR: resource yum_package[Install Postgres Repo] is configured to notify resource package[postgresql94-server, postgresql94-contrib] with action install, but package[postgresql94-server, postgresql94-contrib] cannot be found in the resource collection. yum_package[Install Postgres Repo] is defined in /var/chef/cache/cookbooks/postgres94/recipes/default.rb:19:in 'from_file'

[2015-12-30T15:32:30+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

O que estou fazendo de errado?

    
por Joe 30.12.2015 / 16:44

1 resposta

0

Enquanto isso está sendo elaborado nesse relatório de bug, aqui está uma solução alternativa:

p = package ['postgresql94-server', 'postgresql94-contrib'] do
    action :nothing
end
# ...
notifies :install, p, :immediately

Você sempre pode passar um objeto de recurso explícito para notificações.

    
por 02.01.2016 / 03:01

Tags