Use oslo.utils to escape IPv6 address

Use the common logic instead local own one.

Change-Id: Iaec2380ccb3603b3e77c5a2ecc982acb947313e0
This commit is contained in:
Takashi Kajinami 2024-10-06 00:35:59 +09:00
parent ceb3aa5ef2
commit 2fa7d09fc9

View File

@ -15,6 +15,7 @@ from keystoneauth1.identity import v2
from keystoneauth1 import plugin
from keystoneauth1 import token_endpoint
from oslo_config import cfg
from oslo_utils import netutils
from keystonemiddleware.auth_token import _base
from keystonemiddleware.i18n import _
@ -43,14 +44,8 @@ class AuthTokenPlugin(plugin.BaseAuthPlugin):
'removed in the Newton release, '
"use 'identity_uri' instead.")
if ':' in auth_host:
# Note(dzyu) it is an IPv6 address, so it needs to be wrapped
# with '[]' to generate a valid IPv6 URL, based on
# http://www.ietf.org/rfc/rfc2732.txt
auth_host = '[%s]' % auth_host
identity_uri = '%s://%s:%s' % (auth_protocol,
auth_host,
netutils.escape_ipv6(auth_host),
auth_port)
if auth_admin_prefix: