Browse Source

RPC_backend / transport_url workover

- removed deprecated rabbitmq attributes
- added rabbit_transport_url

Change-Id: Id1fa34e55c556ffae2a6200bb7138f11808a3abf
Christoph Albers 2 years ago
parent
commit
e00cf744d2
2 changed files with 8 additions and 12 deletions
  1. 2
    8
      recipes/common.rb
  2. 6
    4
      spec/spec_helper.rb

+ 2
- 8
recipes/common.rb View File

@@ -44,14 +44,8 @@ node['openstack']['db']['python_packages'][db_type].each do |pkg|
44 44
   end
45 45
 end
46 46
 
47
-unless node['openstack']['orchestration']['conf']['DEFAULT']['rpc_backend'].nil? &&
48
-       node['openstack']['orchestration']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
49
-  user = node['openstack']['mq']['orchestration']['rabbit']['userid']
50
-  node.default['openstack']['orchestration']['conf']
51
-  .[]('oslo_messaging_rabbit')['rabbit_userid'] = user
52
-  node.default['openstack']['orchestration']['conf_secrets']
53
-  .[]('oslo_messaging_rabbit')['rabbit_password'] =
54
-    get_password 'user', user
47
+if node['openstack']['mq']['service_type'] == 'rabbit'
48
+  node.default['openstack']['orchestration']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'orchestration'
55 49
 end
56 50
 
57 51
 db_user = node['openstack']['db']['orchestration']['username']

+ 6
- 4
spec/spec_helper.rb View File

@@ -52,6 +52,9 @@ shared_context 'orchestration_stubs' do
52 52
     allow_any_instance_of(Chef::Recipe).to receive(:get_password)
53 53
       .with('token', 'orchestration_auth_encryption_key')
54 54
       .and_return 'auth_encryption_key_secret'
55
+    allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
56
+      .with('orchestration')
57
+      .and_return('rabbit://guest:mypass@127.0.0.1:5672')
55 58
     allow(Chef::Application).to receive(:fatal!)
56 59
   end
57 60
 end
@@ -187,12 +190,11 @@ shared_examples 'expects to create heat conf' do
187 190
     end
188 191
 
189 192
     describe 'has oslo_messaging_rabbit values' do
190
-      it 'has default oslo_messaging_rabbit values' do
193
+      it 'has default rabbit values' do
191 194
         [
192
-          /^rabbit_userid = guest$/,
193
-          /^rabbit_password = mq-pass$/
195
+          %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}
194 196
         ].each do |line|
195
-          expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
197
+          expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
196 198
         end
197 199
       end
198 200
     end

Loading…
Cancel
Save