From 4a0b9cf2414e6836fb9e18993d13512b0206f0de Mon Sep 17 00:00:00 2001 From: wenchma Date: Tue, 14 Oct 2014 16:40:55 +0800 Subject: [PATCH] Add a temp workaround for an issue #153 in rabbit cookbook After configuring rabbitmq, restart the service to make configuration take effect. So during OpenStack deployment, OpenStack services can connect to rabbitmq successfully. This workaround will notify rabbitmq-server to restart immediately. This could be remove once the issue #153 is fixed in rabbit cookbook. Change-Id: Ib017226f46c7e26429bb26df5b63525e1a98bc82 Closes-Bug: #1380940 --- CHANGELOG.md | 2 ++ recipes/rabbitmq-server.rb | 6 ++++++ spec/rabbitmq-server_spec.rb | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 592830e..110792c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ This file is used to list changes made in each version of cookbook-openstack-ops * Fix metadata version constraint for common * Bump Chef gem to 11.16 * No need to push our rabbit user/password to rabbit cookbook +* Add a temp workaround for an issue #153 in rabbit cookbook to notify + rabbitmq-server to restart immediately. ## 10.0.0 * Upgrading to Juno diff --git a/recipes/rabbitmq-server.rb b/recipes/rabbitmq-server.rb index 15b5728..e5d908e 100644 --- a/recipes/rabbitmq-server.rb +++ b/recipes/rabbitmq-server.rb @@ -100,3 +100,9 @@ rabbitmq_user 'set rabbit administrator tag' do action :set_tags end + +# TODO(wenchma) This could be removed once the issue is fixed in rabbitmq cookbook. +# Issue: https://github.com/kennonkwok/rabbitmq/issues/153 +# Notifies rabbitmq-server service restart. +r = resources(template: "#{node['rabbitmq']['config_root']}/rabbitmq.config") +r.notifies(:restart, "service[#{node['rabbitmq']['service_name']}]", :immediately) diff --git a/spec/rabbitmq-server_spec.rb b/spec/rabbitmq-server_spec.rb index 4db9737..2140ea2 100644 --- a/spec/rabbitmq-server_spec.rb +++ b/spec/rabbitmq-server_spec.rb @@ -124,6 +124,14 @@ describe 'openstack-ops-messaging::rabbitmq-server' do 'set rabbit administrator tag' ).with(user: 'not-a-guest', tag: 'administrator') end + + describe 'notifies immediately' do + let(:template) { chef_run.template('/etc/rabbitmq/rabbitmq.config') } + + it 'sends the specific notification to the service immediately' do + expect(template).to notify('service[rabbitmq-server]').to(:restart).immediately + end + end end end end