From 7352dc8f1eca62870f5e5a351e3cfcbccc3f3260 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Tue, 16 Jan 2024 17:13:19 -0500 Subject: [PATCH] fix: specify endpoint info. for neutron client Closes bug: #2049551 Change-Id: I80a266e500958415a70d462ddfe57e9e03e6ef13 --- octavia/common/clients.py | 15 +++++++++++++-- ...on-client-interface-info-06faaaad92886b8c.yaml | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add-neutron-client-interface-info-06faaaad92886b8c.yaml diff --git a/octavia/common/clients.py b/octavia/common/clients.py index b13642bb04..b839ea3803 100644 --- a/octavia/common/clients.py +++ b/octavia/common/clients.py @@ -79,11 +79,22 @@ class NeutronAuth(object): ksession = keystone.KeystoneSession('neutron') if not cls.neutron_client: sess = ksession.get_session() - - kwargs = {} + kwargs = {'region_name': CONF.neutron.region_name} + # 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: kwargs['network_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( session=sess, **kwargs) diff --git a/releasenotes/notes/add-neutron-client-interface-info-06faaaad92886b8c.yaml b/releasenotes/notes/add-neutron-client-interface-info-06faaaad92886b8c.yaml new file mode 100644 index 0000000000..9a040f42fb --- /dev/null +++ b/releasenotes/notes/add-neutron-client-interface-info-06faaaad92886b8c.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed wrong endpoint information in neutron client configuration.