diff --git a/attributes/neutron_conf.rb b/attributes/neutron_conf.rb index a4949d85..c3030519 100644 --- a/attributes/neutron_conf.rb +++ b/attributes/neutron_conf.rb @@ -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'] diff --git a/recipes/default.rb b/recipes/default.rb index d39b4ea9..12fec599 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -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' diff --git a/spec/default_spec.rb b/spec/default_spec.rb index 2162be1c..23746b54 100644 --- a/spec/default_spec.rb +++ b/spec/default_spec.rb @@ -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| diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cb5ca822..d1d46aa4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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