Browse Source

RPC_backend / transport_url workover

- removed deprecated rabbitmq attributes
- added rabbit_transport_url

Change-Id: I09ab54c7444dca440e15161c62d3203a48463b4a
Christoph Albers 2 years ago
parent
commit
88b37047c7
4 changed files with 6 additions and 31 deletions
  1. 0
    1
      attributes/neutron_conf.rb
  2. 2
    7
      recipes/default.rb
  3. 1
    23
      spec/default_spec.rb
  4. 3
    0
      spec/spec_helper.rb

+ 0
- 1
attributes/neutron_conf.rb View File

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

+ 2
- 7
recipes/default.rb View File

@@ -73,13 +73,8 @@ template '/etc/neutron/rootwrap.conf' do
73 73
   )
74 74
 end
75 75
 
76
-if node['openstack']['network']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
77
-  user = node['openstack']['mq']['network']['rabbit']['userid']
78
-  node.default['openstack']['network']['conf']
79
-  .[]('oslo_messaging_rabbit')['rabbit_userid'] = user
80
-  node.default['openstack']['network']['conf_secrets']
81
-  .[]('oslo_messaging_rabbit')['rabbit_password'] =
82
-    get_password 'user', user
76
+if node['openstack']['mq']['service_type'] == 'rabbit'
77
+  node.default['openstack']['network']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'network'
83 78
 end
84 79
 
85 80
 identity_public_endpoint = public_endpoint 'identity'

+ 1
- 23
spec/default_spec.rb View File

@@ -64,35 +64,13 @@ describe 'openstack-network' do
64 64
       end
65 65
     end
66 66
 
67
-    context 'oslo_messaging' do
68
-      let(:file) { chef_run.template('/etc/neutron/neutron.conf') }
69
-      describe 'has rabbit as default service' do
70
-        before do
71
-          node.set['openstack']['network']['conf']['DEFAULT']['rpc_backend'] = 'rabbit'
72
-        end
73
-        it do
74
-          expect(chef_run).to render_config_file(file.name)
75
-            .with_section_content('oslo_messaging_rabbit', /^rabbit_password = mq-pass/)
76
-        end
77
-      end
78
-      describe 'has no rabbit value if rpc_backend is not default' do
79
-        before do
80
-          node.set['openstack']['network']['conf']['DEFAULT']['rpc_backend'] = 'not_rabbit'
81
-        end
82
-        it do
83
-          expect(chef_run).not_to render_config_file(file.name)
84
-            .with_section_content('oslo_messaging_rabbit', /^rabbit_password =.*$/)
85
-        end
86
-      end
87
-    end
88
-
89 67
     describe '/etc/neutron/neutron.conf' do
90 68
       let(:file) { chef_run.template('/etc/neutron/neutron.conf') }
91 69
       [
92 70
         %r{^log_dir = /var/log/neutron$},
93
-        /^rpc_backend = rabbit$/,
94 71
         /^control_exchange = neutron$/,
95 72
         /^core_plugin = ml2$/,
73
+        %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
96 74
         /^bind_host = 127\.0\.0\.1$/,
97 75
         /^bind_port = 9696$/
98 76
       ].each do |line|

+ 3
- 0
spec/spec_helper.rb View File

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

Loading…
Cancel
Save