Fix the conflict configuration on rabbitmq port

In current logic, rabbitmq port will be set to ssl-listening port,
this will make rabbitmq fail to start.
This submit will configure rabbitmq port for both ssl and non-ssl cases.

Closes-Bug: #1353884

Change-Id: I37dc9b656c553554b9bc636fe35c69744debe92a
This commit is contained in:
wenchma 2014-08-07 16:27:42 +08:00
parent 0a8c79895f
commit c9559630c6
5 changed files with 31 additions and 3 deletions

View File

@ -2,6 +2,9 @@
This file is used to list changes made in each version of cookbook-openstack-ops-messaging.
## 10.0.1
* Configure rabbitmq port for both ssl and non-ssl cases
## 10.0.0
* Upgrading to Juno
* Upgrading berkshelf from 2.0.18 to 3.1.5

View File

@ -50,6 +50,7 @@ The following attributes are defined in attributes/messaging.rb of the common co
* `openstack["endpoints"]["mq"]["port"]` - The port to bind the rabbit service to
* `openstack["endpoints"]["mq"]["path"]` - Unused at this time
* `openstack["endpoints"]["mq"]["bind_interface"]` - The interface name to bind the rabbit service to
* `openstack["mq"]["rabbitmq"]["use_ssl"]` - Enables/disables SSL for RabbitMQ, the default is false.
If the value of the "bind_interface" attribute is non-nil, then the rabbit service will be bound to the first IP address on that interface. If the value of the "bind_interface" attribute is nil, then the rabbit service will be bound to the IP address specified in the host attribute.

View File

@ -4,7 +4,7 @@ maintainer 'Chef Software, Inc.'
maintainer_email 'matt@getchef.com'
license 'Apache 2.0'
description 'Provides the shared messaging configuration for Chef for OpenStack.'
version '10.0.0'
version '10.0.1'
recipe 'server', 'Installs and configures server packages for messaging queue used by the deployment.'
recipe 'rabbitmq-server', 'Installs and configures RabbitMQ and is called via the server recipe'
@ -13,5 +13,5 @@ recipe 'rabbitmq-server', 'Installs and configures RabbitMQ and is called via th
supports os
end
depends 'openstack-common', '~> 10.0'
depends 'openstack-common', '~> 10.0.1'
depends 'rabbitmq', '>= 3.0.4'

View File

@ -33,7 +33,15 @@ listen_address = rabbit_endpoint.host
# Used by OpenStack#rabbit_servers/#rabbit_server
node.set['openstack']['mq']['listen'] = listen_address
node.override['rabbitmq']['port'] = rabbit_endpoint.port
if node['openstack']['mq']['rabbitmq']['use_ssl']
if node['rabbitmq']['ssl_port'] != rabbit_endpoint.port
node.override['rabbitmq']['port'] = rabbit_endpoint.port
else
Chef::Log.error 'Unable to listen on the port #{rabbit_endpoint.port} for RabbitMQ TCP, which is listened on by SSL!'
end
else
node.override['rabbitmq']['port'] = rabbit_endpoint.port
end
node.override['rabbitmq']['address'] = listen_address
node.override['rabbitmq']['default_user'] = user
node.override['rabbitmq']['default_pass'] = pass

View File

@ -12,6 +12,8 @@ describe 'openstack-ops-messaging::rabbitmq-server' do
it 'overrides default rabbit attributes' do
expect(chef_run.node['openstack']['endpoints']['mq']['port']).to eq('5672')
expect(chef_run.node['openstack']['mq']['listen']).to eq('127.0.0.1')
expect(chef_run.node['openstack']['mq']['rabbitmq']['use_ssl']).to be_falsey
expect(chef_run.node['rabbitmq']['port']).to eq(5672)
expect(chef_run.node['rabbitmq']['address']).to eq('127.0.0.1')
expect(chef_run.node['rabbitmq']['default_user']).to eq('guest')
expect(chef_run.node['rabbitmq']['default_pass']).to eq('rabbit-pass')
@ -33,6 +35,20 @@ describe 'openstack-ops-messaging::rabbitmq-server' do
expect(chef_run.node['openstack']['mq']['image']['rabbit']['vhost']).to eq('/bar')
end
describe 'rabbit ssl' do
before do
node.set['openstack']['mq']['rabbitmq']['use_ssl'] = true
end
it 'overrides rabbit ssl attributes' do
node.set['openstack']['endpoints']['mq']['port'] = '5671'
expect(chef_run.node['openstack']['mq']['rabbitmq']['use_ssl']).to be_truthy
expect(chef_run.node['rabbitmq']['ssl_port']).to eq(5671)
expect(chef_run.node['rabbitmq']['port']).to be_nil
end
end
describe 'cluster' do
before do
node.set['openstack']['mq'] = {