diff --git a/README.md b/README.md index 3a433b8..2b7b871 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,18 @@ None # Attributes # -* `openstack["mq"]["bind_interface"]` - bind to interfaces IPv4 address * `openstack["mq"]["cluster"]` - whether or not to cluster rabbit, defaults to 'false' +The following attributes are defined in attributes/messaging.rb of the common cookbook, but are documented here due to their relevance: + +* `openstack["endpoints"]["mq"]["host"]` - The IP address to bind the rabbit service to +* `openstack["endpoints"]["mq"]["scheme"]` - Unused at this time +* `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 + +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. + Testing ===== diff --git a/attributes/default.rb b/attributes/default.rb index 89accca..1d3271b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -19,7 +19,6 @@ # limitations under the License. # -default['openstack']['mq']['bind_interface'] = 'lo' default['openstack']['mq']['cluster'] = false if platform_family?('debian', 'suse') diff --git a/recipes/rabbitmq-server.rb b/recipes/rabbitmq-server.rb index edb8e9b..11fa934 100644 --- a/recipes/rabbitmq-server.rb +++ b/recipes/rabbitmq-server.rb @@ -27,12 +27,13 @@ end user = node['openstack']['mq']['user'] pass = get_password 'user', user vhost = node['openstack']['mq']['vhost'] -listen_address = address_for node['openstack']['mq']['bind_interface'] +rabbit_endpoint = endpoint 'mq' +listen_address = rabbit_endpoint.host # Used by OpenStack#rabbit_servers/#rabbit_server node.set['openstack']['mq']['listen'] = listen_address -node.override['rabbitmq']['port'] = node['openstack']['mq']['port'] +node.override['rabbitmq']['port'] = rabbit_endpoint.port node.override['rabbitmq']['address'] = listen_address node.override['rabbitmq']['default_user'] = user node.override['rabbitmq']['default_pass'] = pass diff --git a/spec/rabbitmq-server_spec.rb b/spec/rabbitmq-server_spec.rb index bb41661..869f168 100644 --- a/spec/rabbitmq-server_spec.rb +++ b/spec/rabbitmq-server_spec.rb @@ -10,7 +10,7 @@ describe 'openstack-ops-messaging::rabbitmq-server' do include_context 'ops_messaging_stubs' it 'overrides default rabbit attributes' do - expect(chef_run.node['openstack']['mq']['port']).to eq('5672') + 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['rabbitmq']['address']).to eq('127.0.0.1') expect(chef_run.node['rabbitmq']['default_user']).to eq('guest') @@ -19,13 +19,13 @@ describe 'openstack-ops-messaging::rabbitmq-server' do end it 'overrides rabbit and openstack image attributes' do - node.set['openstack']['mq']['bind_interface'] = 'eth0' - node.set['openstack']['mq']['port'] = '4242' + node.set['openstack']['endpoints']['mq']['bind_interface'] = 'eth0' + node.set['openstack']['endpoints']['mq']['port'] = '4242' node.set['openstack']['mq']['user'] = 'foo' node.set['openstack']['mq']['vhost'] = '/bar' expect(chef_run.node['openstack']['mq']['listen']).to eq('33.44.55.66') - expect(chef_run.node['openstack']['mq']['port']).to eq('4242') + expect(chef_run.node['openstack']['endpoints']['mq']['port']).to eq('4242') expect(chef_run.node['openstack']['mq']['user']).to eq('foo') expect(chef_run.node['openstack']['mq']['vhost']).to eq('/bar') expect(chef_run.node['openstack']['mq']['image']['rabbit']['port']).to eq('4242')