Merge "Debug list endpoints errors"
This commit is contained in:
commit
093a239759
@ -17,14 +17,19 @@ import typing
|
|||||||
|
|
||||||
from keystoneclient import base
|
from keystoneclient import base
|
||||||
from keystoneclient import client as keystoneclient
|
from keystoneclient import client as keystoneclient
|
||||||
|
from keystoneauth1 import exceptions
|
||||||
from keystoneclient.v2_0 import client as v2_client
|
from keystoneclient.v2_0 import client as v2_client
|
||||||
from keystoneclient.v3 import client as v3_client
|
from keystoneclient.v3 import client as v3_client
|
||||||
from keystoneclient.v3 import endpoints as v3_endpoints
|
from keystoneclient.v3 import endpoints as v3_endpoints
|
||||||
|
from oslo_log import log
|
||||||
|
|
||||||
import tobiko
|
import tobiko
|
||||||
from tobiko.openstack import _client
|
from tobiko.openstack import _client
|
||||||
|
|
||||||
|
|
||||||
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class KeystoneClientFixture(_client.OpenstackClientFixture):
|
class KeystoneClientFixture(_client.OpenstackClientFixture):
|
||||||
|
|
||||||
def init_client(self, session):
|
def init_client(self, session):
|
||||||
@ -107,15 +112,26 @@ def list_endpoints(client=None, service=None, interface=None, region=None,
|
|||||||
if region:
|
if region:
|
||||||
attributes['region_id'] = base.getid(region)
|
attributes['region_id'] = base.getid(region)
|
||||||
|
|
||||||
if client.version == 'v2.0':
|
try:
|
||||||
endpoints = client.endpoints.list()
|
if client.version == 'v2.0':
|
||||||
if translate:
|
endpoints = client.endpoints.list()
|
||||||
endpoints = translate_v2_endpoints(v2_endpoints=endpoints,
|
if translate:
|
||||||
interface=interface)
|
endpoints = translate_v2_endpoints(v2_endpoints=endpoints,
|
||||||
else:
|
interface=interface)
|
||||||
endpoints = client.endpoints.list(service=service,
|
else:
|
||||||
interface=interface,
|
endpoints = client.endpoints.list(service=service,
|
||||||
region=region)
|
interface=interface,
|
||||||
|
region=region)
|
||||||
|
except exceptions.ClientException:
|
||||||
|
LOG.exception('Error listing services endpoints:\n'
|
||||||
|
f' client: {client}\n'
|
||||||
|
f' service: {service}\n'
|
||||||
|
f' interface: {interface}\n'
|
||||||
|
f' region: {region}\n'
|
||||||
|
f' translate: {translate}\n'
|
||||||
|
f' attributes: {attributes}\n')
|
||||||
|
raise
|
||||||
|
|
||||||
endpoints = tobiko.select(endpoints)
|
endpoints = tobiko.select(endpoints)
|
||||||
if attributes:
|
if attributes:
|
||||||
endpoints = endpoints.with_attributes(**attributes)
|
endpoints = endpoints.with_attributes(**attributes)
|
||||||
|
Loading…
Reference in New Issue
Block a user