Fix api_discovery with keystone v3

With keystone v3 to get a public endpoint for a service,
we need to check for interface="public".

Change-Id: I36de9adf04352073c9727bd3cc88379fbc353aa8
This commit is contained in:
yatin 2017-10-25 18:07:02 +05:30
parent 96a257e6c7
commit 5fa5f9c51d

View File

@ -245,9 +245,14 @@ def discover(auth_provider, region, object_store_discovery=True,
name = entry['type'] name = entry['type']
services[name] = dict() services[name] = dict()
for _ep in entry['endpoints']: for _ep in entry['endpoints']:
if _ep['region'] == region: if api_version == 3:
ep = _ep if _ep['region'] == region and _ep['interface'] == 'public':
break ep = _ep
break
else:
if _ep['region'] == region:
ep = _ep
break
else: else:
ep = entry['endpoints'][0] ep = entry['endpoints'][0]
if 'identity' in ep[public_url]: if 'identity' in ep[public_url]: