fix: specify endpoint info. for neutron client

Closes bug: #2049551

Change-Id: I80a266e500958415a70d462ddfe57e9e03e6ef13
This commit is contained in:
Mohammed Naser 2024-01-16 17:13:19 -05:00 committed by ricolin
parent 5750e4512d
commit 7352dc8f1e
2 changed files with 17 additions and 2 deletions

View File

@ -79,11 +79,22 @@ class NeutronAuth(object):
ksession = keystone.KeystoneSession('neutron') ksession = keystone.KeystoneSession('neutron')
if not cls.neutron_client: if not cls.neutron_client:
sess = ksession.get_session() sess = ksession.get_session()
kwargs = {'region_name': CONF.neutron.region_name}
kwargs = {} # TODO(ricolin) `interface` option don't take list as option yet.
# We can move away from this when openstacksdk no longer depends
# on `interface`.
try:
interface = CONF.neutron.valid_interfaces[0]
except (TypeError, LookupError):
interface = CONF.neutron.valid_interfaces
if interface:
kwargs['interface'] = interface
if CONF.neutron.endpoint_override: if CONF.neutron.endpoint_override:
kwargs['network_endpoint_override'] = ( kwargs['network_endpoint_override'] = (
CONF.neutron.endpoint_override) CONF.neutron.endpoint_override)
if CONF.neutron.endpoint_override.startswith("https"):
kwargs['insecure'] = CONF.neutron.insecure
kwargs['cacert'] = CONF.neutron.cafile
conn = openstack.connection.Connection( conn = openstack.connection.Connection(
session=sess, **kwargs) session=sess, **kwargs)

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Fixed wrong endpoint information in neutron client configuration.