From 2f858e3678ced8ab3b35879233e18da659c265dc Mon Sep 17 00:00:00 2001 From: Christoph Albers Date: Fri, 16 Dec 2016 16:59:41 +0100 Subject: [PATCH] RPC_backend / transport_url workover - removed deprecated rabbitmq attributes - added rabbit_transport_url Change-Id: I0ca0fcc1e261eeadb76c9355a0f14499085d9bda --- attributes/keystone_conf.rb | 2 +- recipes/server-apache.rb | 9 ++------- spec/server-apache_spec.rb | 17 ++++------------- spec/spec_helper.rb | 3 +++ 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/attributes/keystone_conf.rb b/attributes/keystone_conf.rb index 30083c3..2eeb491 100644 --- a/attributes/keystone_conf.rb +++ b/attributes/keystone_conf.rb @@ -14,7 +14,7 @@ default['openstack']['identity']['conf'].tap do |conf| # [DEFAULT] option in keystone.conf to define mq notification topics conf['DEFAULT']['notification_topics'] = 'notifications' end - conf['DEFAULT']['rpc_backend'] = node['openstack']['mq']['service_type'] + # [assignment] option in keystone.conf to set driver conf['assignment']['driver'] = 'keystone.assignment.backends.sql.Assignment' diff --git a/recipes/server-apache.rb b/recipes/server-apache.rb index baffe44..dfc02d6 100644 --- a/recipes/server-apache.rb +++ b/recipes/server-apache.rb @@ -154,13 +154,8 @@ else end # set keystone config parameter for rabbitmq if rabbit is the rpc_backend -if node['openstack']['identity']['conf']['DEFAULT']['rpc_backend'] == 'rabbit' - user = node['openstack']['mq']['identity']['rabbit']['userid'] - node.default['openstack']['identity']['conf_secrets'] - .[]('oslo_messaging_rabbit')['rabbit_userid'] = user - node.default['openstack']['identity']['conf_secrets'] - .[]('oslo_messaging_rabbit')['rabbit_password'] = - get_password 'user', user +if node['openstack']['mq']['service_type'] == 'rabbit' + node.default['openstack']['identity']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'identity' end # set keystone config parameters for admin_token, endpoints and memcache diff --git a/spec/server-apache_spec.rb b/spec/server-apache_spec.rb index 875d911..3387c92 100644 --- a/spec/server-apache_spec.rb +++ b/spec/server-apache_spec.rb @@ -130,8 +130,10 @@ describe 'openstack-identity::server-apache' do expect(chef_run).not_to render_config_file(path).with_section_content('DEFAULT', /^list_limit = /) end - it 'has rpc_backend set for rabbit' do - expect(chef_run).to render_config_file(path).with_section_content('DEFAULT', /^rpc_backend = rabbit$/) + it 'has default transport_url/AMQP options set' do + [%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}].each do |line| + expect(chef_run).to render_file(path).with_content(line) + end end describe '[DEFAULT] section' do @@ -251,17 +253,6 @@ describe 'openstack-identity::server-apache' do expect(chef_run).to render_config_file(path).with_section_content('policy', r) end end - - describe '[oslo_messaging_rabbit] section' do - it 'has defaults for oslo_messaging_rabbit section' do - [ - /^rabbit_userid = guest$/, - /^rabbit_password = guest$/ - ].each do |line| - expect(chef_run).to render_config_file(path).with_section_content('oslo_messaging_rabbit', line) - end - end - end end describe 'default_catalog.templates' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 65550bc..713f84c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -64,5 +64,8 @@ shared_context 'identity_stubs' do allow_any_instance_of(Chef::Recipe).to receive(:get_password) .with('user', 'admin') .and_return('admin') + allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url) + .with('identity') + .and_return('rabbit://guest:mypass@127.0.0.1:5672') end end