Browse Source

Use identity_uri_transform

Remove deprecated keys and use identity_uri via the new transform
helper method.

Also, cleanup specs for endpoint testing to make sure Common is
fully tested.

Change-Id: I5a26d8cb83193e4bf66bb952f7973838d6acba40
Implements: blueprint identity-uri
Mark Vanderwiel 4 years ago
parent
commit
ab8aa01421
3 changed files with 15 additions and 51 deletions
  1. 2
    1
      recipes/cinder-common.rb
  2. 12
    33
      spec/cinder_common_spec.rb
  3. 1
    17
      templates/default/cinder.conf.erb

+ 2
- 1
recipes/cinder-common.rb View File

@@ -91,6 +91,7 @@ identity_admin_endpoint = admin_endpoint 'identity-admin'
91 91
 service_pass = get_password 'service', 'openstack-block-storage'
92 92
 
93 93
 auth_uri = auth_uri_transform(identity_endpoint.to_s, node['openstack']['block-storage']['api']['auth']['version'])
94
+identity_uri = identity_uri_transform(identity_admin_endpoint)
94 95
 
95 96
 template '/etc/cinder/cinder.conf' do
96 97
   source 'cinder.conf.erb'
@@ -115,7 +116,7 @@ template '/etc/cinder/cinder.conf' do
115 116
     enabled_drivers: enabled_drivers,
116 117
     multi_backend_sections: multi_backend_sections,
117 118
     auth_uri: auth_uri,
118
-    identity_admin_endpoint: identity_admin_endpoint,
119
+    identity_uri: identity_uri,
119 120
     service_pass: service_pass
120 121
   )
121 122
 end

+ 12
- 33
spec/cinder_common_spec.rb View File

@@ -42,21 +42,6 @@ describe 'openstack-block-storage::cinder-common' do
42 42
       let(:file) { chef_run.template('/etc/cinder/cinder.conf') }
43 43
       let(:test_pass) { 'test_pass' }
44 44
       before do
45
-        endpoint = double(port: 'port', host: 'host', scheme: 'scheme')
46
-        allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
47
-          .with('image-api')
48
-          .and_return(endpoint)
49
-        allow_any_instance_of(Chef::Recipe).to receive(:admin_endpoint)
50
-          .with('identity-admin')
51
-          .and_return(endpoint)
52
-        allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
53
-          .with('identity-internal')
54
-          .and_return(endpoint)
55
-        allow_any_instance_of(Chef::Recipe).to receive(:endpoint)
56
-          .with('block-storage-api-bind')
57
-          .and_return(endpoint)
58
-        allow_any_instance_of(Chef::Recipe).to receive(:auth_uri_transform)
59
-          .and_return('auth_uri_transform')
60 45
         allow_any_instance_of(Chef::Recipe).to receive(:get_password)
61 46
           .with('user', anything)
62 47
           .and_return(test_pass)
@@ -141,19 +126,11 @@ describe 'openstack-block-storage::cinder-common' do
141 126
         context 'endpoint related' do
142 127
 
143 128
           it 'has auth_uri' do
144
-            expect(chef_run).to render_file(file.name).with_content(/^auth_uri = auth_uri_transform$/)
129
+            expect(chef_run).to render_file(file.name).with_content(%r(^auth_uri = http://127.0.0.1:5000/v2.0$))
145 130
           end
146 131
 
147
-          it 'has auth_host' do
148
-            expect(chef_run).to render_file(file.name).with_content(/^auth_host = host$/)
149
-          end
150
-
151
-          it 'has auth_port' do
152
-            expect(chef_run).to render_file(file.name).with_content(/^auth_port = port$/)
153
-          end
154
-
155
-          it 'has auth_protocol' do
156
-            expect(chef_run).to render_file(file.name).with_content(/^auth_protocol = scheme$/)
132
+          it 'has identity_uri' do
133
+            expect(chef_run).to render_file(file.name).with_content(%r(^identity_uri = http://127.0.0.1:35357/$))
157 134
           end
158 135
         end
159 136
 
@@ -263,7 +240,7 @@ describe 'openstack-block-storage::cinder-common' do
263 240
 
264 241
         context 'glance endpoint' do
265 242
           it 'has a glance_api_servers attribute' do
266
-            expect(chef_run).to render_file(file.name).with_content(%r{^glance_api_servers=scheme://host:port$})
243
+            expect(chef_run).to render_file(file.name).with_content(%r{^glance_api_servers=http://127.0.0.1:9292$})
267 244
           end
268 245
 
269 246
           it 'has glance_api_version attribute' do
@@ -288,10 +265,12 @@ describe 'openstack-block-storage::cinder-common' do
288 265
             expect(chef_run).to render_file(file.name).with_content(%r{^glance_ca_certificates_file=dir/to/path$})
289 266
           end
290 267
 
291
-          %w(host port).each do |glance_attr|
292
-            it "has a glance #{glance_attr} attribute" do
293
-              expect(chef_run).to render_file(file.name).with_content(/^glance_#{glance_attr}=#{glance_attr}$/)
294
-            end
268
+          it 'has a glance host attribute' do
269
+            expect(chef_run).to render_file(file.name).with_content(/^glance_host=127.0.0.1$/)
270
+          end
271
+
272
+          it 'has a glance port attribute' do
273
+            expect(chef_run).to render_file(file.name).with_content(/^glance_port=9292$/)
295 274
           end
296 275
         end
297 276
 
@@ -302,11 +281,11 @@ describe 'openstack-block-storage::cinder-common' do
302 281
 
303 282
         context 'cinder endpoint' do
304 283
           it 'has osapi_volume_listen set' do
305
-            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen=host$/)
284
+            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen=127.0.0.1$/)
306 285
           end
307 286
 
308 287
           it 'has osapi_volume_listen_port set' do
309
-            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen_port=port$/)
288
+            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen_port=8776$/)
310 289
           end
311 290
         end
312 291
 

+ 1
- 17
templates/default/cinder.conf.erb View File

@@ -1080,29 +1080,13 @@ enabled_backends = <%= @multi_backend_sections.keys.join(',') %>
1080 1080
 # Options defined in keystonemiddleware.auth_token
1081 1081
 #
1082 1082
 
1083
-# Prefix to prepend at the beginning of the path. Deprecated,
1084
-# use identity_uri. (string value)
1085
-#auth_admin_prefix=
1086
-
1087
-# Host providing the admin Identity API endpoint. Deprecated,
1088
-# use identity_uri. (string value)
1089
-auth_host = <%= @identity_admin_endpoint.host %>
1090
-
1091
-# Port of the admin Identity API endpoint. Deprecated, use
1092
-# identity_uri. (integer value)
1093
-auth_port = <%= @identity_admin_endpoint.port %>
1094
-
1095
-# Protocol of the admin Identity API endpoint (http or https).
1096
-# Deprecated, use identity_uri. (string value)
1097
-auth_protocol = <%= @identity_admin_endpoint.scheme %>
1098
-
1099 1083
 # Complete public Identity API endpoint (string value)
1100 1084
 auth_uri = <%= @auth_uri %>
1101 1085
 
1102 1086
 # Complete admin Identity API endpoint. This should specify
1103 1087
 # the unversioned root endpoint e.g. https://localhost:35357/
1104 1088
 # (string value)
1105
-#identity_uri=<None>
1089
+identity_uri = <%= @identity_uri %>
1106 1090
 
1107 1091
 # API version of the admin Identity API endpoint (string
1108 1092
 # value)

Loading…
Cancel
Save