RPC_backend / transport_url workover

- removed deprecated rabbitmq attributes
- added rabbit_transport_url

Change-Id: I09ab54c7444dca440e15161c62d3203a48463b4a
This commit is contained in:
Christoph Albers 2016-12-16 17:31:28 +01:00 committed by Jan Klare
parent d885b68c6d
commit 88b37047c7
4 changed files with 6 additions and 31 deletions

View File

@ -11,7 +11,6 @@ default['openstack']['network']['conf'].tap do |conf|
end
conf['DEFAULT']['control_exchange'] = node['openstack']['mq']['network']['control_exchange']
conf['DEFAULT']['core_plugin'] = 'ml2'
conf['DEFAULT']['rpc_backend'] = node['openstack']['mq']['service_type']
# [agent] section
if node['openstack']['network']['use_rootwrap']

View File

@ -73,13 +73,8 @@ template '/etc/neutron/rootwrap.conf' do
)
end
if node['openstack']['network']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
user = node['openstack']['mq']['network']['rabbit']['userid']
node.default['openstack']['network']['conf']
.[]('oslo_messaging_rabbit')['rabbit_userid'] = user
node.default['openstack']['network']['conf_secrets']
.[]('oslo_messaging_rabbit')['rabbit_password'] =
get_password 'user', user
if node['openstack']['mq']['service_type'] == 'rabbit'
node.default['openstack']['network']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'network'
end
identity_public_endpoint = public_endpoint 'identity'

View File

@ -64,35 +64,13 @@ describe 'openstack-network' do
end
end
context 'oslo_messaging' do
let(:file) { chef_run.template('/etc/neutron/neutron.conf') }
describe 'has rabbit as default service' do
before do
node.set['openstack']['network']['conf']['DEFAULT']['rpc_backend'] = 'rabbit'
end
it do
expect(chef_run).to render_config_file(file.name)
.with_section_content('oslo_messaging_rabbit', /^rabbit_password = mq-pass/)
end
end
describe 'has no rabbit value if rpc_backend is not default' do
before do
node.set['openstack']['network']['conf']['DEFAULT']['rpc_backend'] = 'not_rabbit'
end
it do
expect(chef_run).not_to render_config_file(file.name)
.with_section_content('oslo_messaging_rabbit', /^rabbit_password =.*$/)
end
end
end
describe '/etc/neutron/neutron.conf' do
let(:file) { chef_run.template('/etc/neutron/neutron.conf') }
[
%r{^log_dir = /var/log/neutron$},
/^rpc_backend = rabbit$/,
/^control_exchange = neutron$/,
/^core_plugin = ml2$/,
%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
/^bind_host = 127\.0\.0\.1$/,
/^bind_port = 9696$/
].each do |line|

View File

@ -48,6 +48,9 @@ shared_context 'neutron-stubs' do
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin')
.and_return('admin-pass')
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
.with('network')
.and_return('rabbit://guest:mypass@127.0.0.1:5672')
end
shared_examples 'custom template banner displayer' do
it 'shows the custom banner' do