Browse Source

Deprecate auth_uri option

Option auth_uri from group keystone_authtoken is deprecated[1].
Use option www_authenticate_uri from group keystone_authtoken.

[1]https://review.openstack.org/#/c/508522/

Change-Id: I0dd36ef1f1f5dcdc57413736ecb8f2555712c36d
Depends-On: I4c82a63baabd6b9304b302c97cd751a0103d8316
Closes-Bug: #1759098
tags/13.1.0
ZhongShengping 1 year ago
parent
commit
20d93c4148

+ 2
- 2
lib/puppet/provider/nova.rb View File

@@ -82,7 +82,7 @@ class Puppet::Provider::Nova < Puppet::Provider::Openstack
82 82
 
83 83
   def self.get_nova_credentials
84 84
     #needed keys for authentication
85
-    auth_keys = ['auth_uri', 'project_name', 'username', 'password']
85
+    auth_keys = ['www_authenticate_uri', 'project_name', 'username', 'password']
86 86
     conf = nova_conf
87 87
     if conf and conf['keystone_authtoken'] and
88 88
         auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
@@ -111,7 +111,7 @@ class Puppet::Provider::Nova < Puppet::Provider::Openstack
111 111
 
112 112
   def self.get_auth_endpoint
113 113
     q = nova_credentials
114
-    "#{q['auth_uri']}"
114
+    "#{q['www_authenticate_uri']}"
115 115
   end
116 116
 
117 117
   def self.auth_endpoint

+ 1
- 1
lib/puppet/type/nova_aggregate.rb View File

@@ -50,7 +50,7 @@ Puppet::Type.newtype(:nova_aggregate) do
50 50
   ensurable
51 51
 
52 52
   autorequire(:nova_config) do
53
-    ['auth_uri', 'project_name', 'username', 'password']
53
+    ['www_authenticate_uri', 'project_name', 'username', 'password']
54 54
   end
55 55
 
56 56
   newparam(:name, :namevar => true) do

+ 1
- 1
lib/puppet/type/nova_flavor.rb View File

@@ -56,7 +56,7 @@ Puppet::Type.newtype(:nova_flavor) do
56 56
   ensurable
57 57
 
58 58
   autorequire(:nova_config) do
59
-    ['auth_uri', 'project_name', 'username', 'password']
59
+    ['www_authenticate_uri', 'project_name', 'username', 'password']
60 60
   end
61 61
 
62 62
   # Require the nova-api service to be running

+ 2
- 1
manifests/api.pp View File

@@ -552,7 +552,8 @@ as a standalone service, or httpd for being run by a httpd server")
552 552
     #Admin tenant name real
553 553
     $atnr = $::nova::keystone::authtoken::project_name
554 554
     #Keystone Auth URI
555
-    $kau = $::nova::keystone::authtoken::auth_uri
555
+    # TODO(tobasco): Remove pick when auth_uri is removed.
556
+    $kau = pick($::nova::keystone::authtoken::auth_uri, $::nova::keystone::authtoken::www_authenticate_uri)
556 557
     $defaults = {
557 558
       'nova-api' => {
558 559
         'command'  => "nova --os-auth-url ${kau} --os-project-name ${atnr} --os-username ${aur} --os-password ${apr} flavor-list",

+ 16
- 3
manifests/keystone/authtoken.pp View File

@@ -42,7 +42,7 @@
42 42
 #   (Optional) Authentication type to load
43 43
 #   Defaults to $::os_service_default
44 44
 #
45
-# [*auth_uri*]
45
+# [*www_authenticate_uri*]
46 46
 #   (Optional) Complete public Identity API endpoint.
47 47
 #   Defaults to 'http://127.0.0.1:5000/'.
48 48
 #
@@ -178,6 +178,12 @@
178 178
 #   (in seconds). Set to -1 to disable caching completely. Integer value
179 179
 #   Defaults to $::os_service_default.
180 180
 #
181
+# DEPRECATED PARAMETERS
182
+#
183
+# [*auth_uri*]
184
+#   (Optional) Complete public Identity API endpoint.
185
+#   Defaults to undef
186
+#
181 187
 class nova::keystone::authtoken(
182 188
   $username                       = 'nova',
183 189
   $password                       = $::os_service_default,
@@ -188,7 +194,7 @@ class nova::keystone::authtoken(
188 194
   $insecure                       = $::os_service_default,
189 195
   $auth_section                   = $::os_service_default,
190 196
   $auth_type                      = 'password',
191
-  $auth_uri                       = 'http://127.0.0.1:5000/',
197
+  $www_authenticate_uri           = 'http://127.0.0.1:5000/',
192 198
   $auth_version                   = $::os_service_default,
193 199
   $cache                          = $::os_service_default,
194 200
   $cafile                         = $::os_service_default,
@@ -213,6 +219,8 @@ class nova::keystone::authtoken(
213 219
   $manage_memcache_package        = false,
214 220
   $region_name                    = $::os_service_default,
215 221
   $token_cache_time               = $::os_service_default,
222
+  # DEPRECATED PARAMETERS
223
+  $auth_uri                       = undef,
216 224
 ) {
217 225
 
218 226
   include ::nova::deps
@@ -221,12 +229,17 @@ class nova::keystone::authtoken(
221 229
     fail('Please set password for nova service user')
222 230
   }
223 231
 
232
+  if $auth_uri {
233
+    warning('The auth_uri parameter is deprecated. Please use www_authenticate_uri instead.')
234
+  }
235
+  $www_authenticate_uri_real = pick($auth_uri, $www_authenticate_uri)
236
+
224 237
   keystone::resource::authtoken { 'nova_config':
225 238
     username                       => $username,
226 239
     password                       => $password,
227 240
     project_name                   => $project_name,
228 241
     auth_url                       => $auth_url,
229
-    auth_uri                       => $auth_uri,
242
+    www_authenticate_uri           => $www_authenticate_uri_real,
230 243
     auth_version                   => $auth_version,
231 244
     auth_type                      => $auth_type,
232 245
     auth_section                   => $auth_section,

+ 16
- 3
manifests/metadata/novajoin/authtoken.pp View File

@@ -42,7 +42,7 @@
42 42
 #   (Optional) Authentication type to load
43 43
 #   Defaults to $::os_service_default
44 44
 #
45
-# [*auth_uri*]
45
+# [*www_authenticate_uri*]
46 46
 #   (Optional) Complete public Identity API endpoint.
47 47
 #   Defaults to 'http://127.0.0.1:5000/'.
48 48
 #
@@ -178,6 +178,12 @@
178 178
 #   (in seconds). Set to -1 to disable caching completely. Integer value
179 179
 #   Defaults to $::os_service_default.
180 180
 #
181
+# DEPRECATED PARAMETERS
182
+#
183
+# [*auth_uri*]
184
+#   (Optional) Complete public Identity API endpoint.
185
+#   Defaults to undef
186
+#
181 187
 class nova::metadata::novajoin::authtoken(
182 188
   $username                       = 'novajoin',
183 189
   $password                       = $::os_service_default,
@@ -188,7 +194,7 @@ class nova::metadata::novajoin::authtoken(
188 194
   $insecure                       = $::os_service_default,
189 195
   $auth_section                   = $::os_service_default,
190 196
   $auth_type                      = 'password',
191
-  $auth_uri                       = 'http://127.0.0.1:5000/',
197
+  $www_authenticate_uri           = 'http://127.0.0.1:5000/',
192 198
   $auth_version                   = $::os_service_default,
193 199
   $cache                          = $::os_service_default,
194 200
   $cafile                         = $::os_service_default,
@@ -213,18 +219,25 @@ class nova::metadata::novajoin::authtoken(
213 219
   $manage_memcache_package        = false,
214 220
   $region_name                    = $::os_service_default,
215 221
   $token_cache_time               = $::os_service_default,
222
+  # DEPRECATED PARAMETERS
223
+  $auth_uri                       = undef,
216 224
 ) {
217 225
 
218 226
   if is_service_default($password) {
219 227
     fail('Please set password for novajoin service user')
220 228
   }
221 229
 
230
+  if $auth_uri {
231
+    warning('The auth_uri parameter is deprecated. Please use www_authenticate_uri instead.')
232
+  }
233
+  $www_authenticate_uri_real = pick($auth_uri, $www_authenticate_uri)
234
+
222 235
   keystone::resource::authtoken { 'novajoin_config':
223 236
     username                       => $username,
224 237
     password                       => $password,
225 238
     project_name                   => $project_name,
226 239
     auth_url                       => $auth_url,
227
-    auth_uri                       => $auth_uri,
240
+    www_authenticate_uri           => $www_authenticate_uri_real,
228 241
     auth_version                   => $auth_version,
229 242
     auth_type                      => $auth_type,
230 243
     auth_section                   => $auth_section,

+ 6
- 0
releasenotes/notes/deprecate_auth_uri_parameter-82edf8271e3c276f.yaml View File

@@ -0,0 +1,6 @@
1
+---
2
+deprecations:
3
+  - nova::keystone::authtoken::auth_uri is deprecated and will be removed in a future release.
4
+    Please use www_authenticate_uri instead.
5
+  - nova::metadata::novajoin::authtoken::auth_uri is deprecated and will be removed in a future release.
6
+    Please use www_authenticate_uri instead.

+ 3
- 3
spec/classes/nova_keystone_authtoken_spec.rb View File

@@ -20,7 +20,7 @@ describe 'nova::keystone::authtoken' do
20 20
         is_expected.to contain_nova_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
21 21
         is_expected.to contain_nova_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
22 22
         is_expected.to contain_nova_config('keystone_authtoken/auth_type').with_value('password')
23
-        is_expected.to contain_nova_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/')
23
+        is_expected.to contain_nova_config('keystone_authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000/')
24 24
         is_expected.to contain_nova_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
25 25
         is_expected.to contain_nova_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
26 26
         is_expected.to contain_nova_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
@@ -50,7 +50,7 @@ describe 'nova::keystone::authtoken' do
50 50
     context 'when overriding parameters' do
51 51
       before do
52 52
         params.merge!({
53
-          :auth_uri                             => 'https://10.0.0.1:9999/',
53
+          :www_authenticate_uri                 => 'https://10.0.0.1:9999/',
54 54
           :username                             => 'myuser',
55 55
           :password                             => 'mypasswd',
56 56
           :auth_url                             => 'http://:127.0.0.1:35357',
@@ -90,7 +90,7 @@ describe 'nova::keystone::authtoken' do
90 90
       end
91 91
 
92 92
       it 'configure keystone_authtoken' do
93
-        is_expected.to contain_nova_config('keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/') 
93
+        is_expected.to contain_nova_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/') 
94 94
         is_expected.to contain_nova_config('keystone_authtoken/username').with_value(params[:username])
95 95
         is_expected.to contain_nova_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
96 96
         is_expected.to contain_nova_config('keystone_authtoken/auth_url').with_value(params[:auth_url])

+ 3
- 3
spec/classes/nova_metadata_novajoin_authtoken_spec.rb View File

@@ -20,7 +20,7 @@ describe 'nova::metadata::novajoin::authtoken' do
20 20
         is_expected.to contain_novajoin_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
21 21
         is_expected.to contain_novajoin_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
22 22
         is_expected.to contain_novajoin_config('keystone_authtoken/auth_type').with_value('password')
23
-        is_expected.to contain_novajoin_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/')
23
+        is_expected.to contain_novajoin_config('keystone_authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000/')
24 24
         is_expected.to contain_novajoin_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
25 25
         is_expected.to contain_novajoin_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
26 26
         is_expected.to contain_novajoin_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
@@ -50,7 +50,7 @@ describe 'nova::metadata::novajoin::authtoken' do
50 50
     context 'when overriding parameters' do
51 51
       before do
52 52
         params.merge!({
53
-          :auth_uri                             => 'https://10.0.0.1:9999/',
53
+          :www_authenticate_uri                 => 'https://10.0.0.1:9999/',
54 54
           :username                             => 'myuser',
55 55
           :password                             => 'mypasswd',
56 56
           :auth_url                             => 'http://:127.0.0.1:35357',
@@ -90,7 +90,7 @@ describe 'nova::metadata::novajoin::authtoken' do
90 90
       end
91 91
 
92 92
       it 'configure keystone_authtoken' do
93
-        is_expected.to contain_novajoin_config('keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/')
93
+        is_expected.to contain_novajoin_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/')
94 94
         is_expected.to contain_novajoin_config('keystone_authtoken/username').with_value(params[:username])
95 95
         is_expected.to contain_novajoin_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
96 96
         is_expected.to contain_novajoin_config('keystone_authtoken/auth_url').with_value(params[:auth_url])

+ 5
- 5
spec/unit/provider/nova_spec.rb View File

@@ -11,11 +11,11 @@ describe Puppet::Provider::Nova do
11 11
 
12 12
   let :credential_hash do
13 13
     {
14
-      'auth_uri'     => 'https://192.168.56.210:35357/v2.0/',
15
-      'project_name' => 'admin_tenant',
16
-      'username'     => 'admin',
17
-      'password'     => 'password',
18
-      'region_name'  => 'Region1',
14
+      'www_authenticate_uri' => 'https://192.168.56.210:35357/v2.0/',
15
+      'project_name'         => 'admin_tenant',
16
+      'username'             => 'admin',
17
+      'password'             => 'password',
18
+      'region_name'          => 'Region1',
19 19
     }
20 20
   end
21 21
 

Loading…
Cancel
Save