Issue
I have a very simple chef recipe which attempts to install RabbitMQ and several RabbitMQ Plugins on an EC2 & Vagrant VM (both running Ubuntu 12.04).
I'm using the OpsCode RabbitMQ cookbook (https://github.com/opscode-cookbooks/rabbitmq), and when I provision the machine(s) I get the following stack trace:
INFO: Processing apt_repository[rabbitmq] action add (rabbitmq::default line 43)
INFO: Processing remote_file[/srv/chef/file_store/rabbitmq-signing-key-public.asc] action create (/srv/chef/file_store/cookbooks/apt/providers/repository.rb line 36)
INFO: remote_file[/srv/chef/file_store/rabbitmq-signing-key-public.asc] updated
INFO: remote_file[/srv/chef/file_store/rabbitmq-signing-key-public.asc] mode changed to 644
INFO: Processing execute[install-key rabbitmq-signing-key-public.asc] action run (/srv/chef/file_store/cookbooks/apt/providers/repository.rb line 52)
INFO: execute[install-key rabbitmq-signing-key-public.asc] ran successfully
INFO: apt_repository[rabbitmq] sending run action to execute[apt-get update] (immediate)
INFO: Processing execute[apt-get update] action run (apt::default line 29)
INFO: execute[apt-get update] ran successfully
INFO: Processing remote_file[/srv/chef/file_store/rabbitmq-signing-key-public.asc] action nothing (/srv/chef/file_store/cookbooks/apt/providers/repository.rb line 36)
INFO: Processing execute[install-key rabbitmq-signing-key-public.asc] action nothing (/srv/chef/file_store/cookbooks/apt/providers/repository.rb line 52)
INFO: Processing execute[apt-get update] action nothing (/srv/chef/file_store/cookbooks/apt/providers/repository.rb line 78)
INFO: Processing file[/etc/apt/sources.list.d/rabbitmq-source.list] action create (/srv/chef/file_store/cookbooks/apt/providers/repository.rb line 89)
INFO: file[/etc/apt/sources.list.d/rabbitmq-source.list] created file /etc/apt/sources.list.d/rabbitmq-source.list
INFO: Processing package[util-linux] action install (rabbitmq::default line 53)
INFO: Processing package[rabbitmq-server] action install (rabbitmq::default line 54)
ERROR: package[rabbitmq-server] (rabbitmq::default line 54) has had an error
...
FATAL: Chef::Exceptions::Exec: package[rabbitmq-server] (rabbitmq::default line 54) had an error: Chef::Exceptions::Exec: apt-get -q -y install rabbitmq-server=2.7.1-0ubuntu4 returned 100, expected 0
As you can see by the logs the apt-get update
is happening before the new rabbitmq source is added (meaning it tries to install rabbitmq-server version 2.7.1 vs. the 2.8.x version from the RabbitMQ repository.
This is the cookbook code: https://github.com/opscode-cookbooks/rabbitmq/blob/master/recipes/default.rb#L43-54
Any ideas how to resolve the issue?
Solution
I've got the 2 fixes you need.
apt_repository wasn't kicking off a proper apt-get update when new repos were added. http://tickets.opscode.com/browse/COOK-1530 has the fix.
rabbitmq's apt_repository wasn't triggering the apt-get update http://tickets.opscode.com/browse/COOK-1496 with the apt cookbook update fixes it. This was merged to https://github.com/opscode-cookbooks/rabbitmq master today.
New releases of the 2 cookbooks should fix everything, hopefully this week. Feel free to grab from github in the meantime and ping me with any further questions.
matt@opscode
Answered By - mray Answer Checked By - Clifford M. (WPSolving Volunteer)