From 93e03868d32458735efa3005b2a2f067622bf11c Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Tue, 24 Oct 2017 01:14:07 +0800 Subject: Fix bug of keystone v2.0 API Change-Id: I3683a867efc5c836b1d842dcdcd8240f4829f9f3 Issue-Id: MULTICLOUD-118 Signed-off-by: Bin Yang --- newton/newton/proxy/views/identityV3.py | 11 +++++++++-- newton/newton/proxy/views/proxy_utils.py | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/newton/newton/proxy/views/identityV3.py b/newton/newton/proxy/views/identityV3.py index bc2b06e9..7395fac8 100644 --- a/newton/newton/proxy/views/identityV3.py +++ b/newton/newton/proxy/views/identityV3.py @@ -156,8 +156,14 @@ class TokensV2(Tokens): } #convert endpoints - v2_catalog1_endpoints = {"id": v3_catalog['id']} + v2_catalog1_endpoints = None for v3_endpoint in v3_catalog['endpoints']: + v2_catalog1_endpoints = { + "id": v3_endpoint['id'], + "region":v3_endpoint['region'], + "region_id": v3_endpoint['region_id'], + 'interface':v3_endpoint['interface'] + } if v3_endpoint['interface'] == 'public': v2_catalog1_endpoints['publicURL'] = v3_endpoint['url'] elif v3_endpoint['interface'] == 'admin': @@ -165,7 +171,8 @@ class TokensV2(Tokens): elif v3_endpoint['interface'] == 'internal': v2_catalog1_endpoints['internalURL'] = v3_endpoint['url'] - v2_catalog1['endpoints'].append(v2_catalog1_endpoints) + if v2_catalog1_endpoints: + v2_catalog1['endpoints'].append(v2_catalog1_endpoints) v2_catalog.append(v2_catalog1) diff --git a/newton/newton/proxy/views/proxy_utils.py b/newton/newton/proxy/views/proxy_utils.py index c80b9680..68182d4a 100644 --- a/newton/newton/proxy/views/proxy_utils.py +++ b/newton/newton/proxy/views/proxy_utils.py @@ -158,13 +158,13 @@ class ProxyUtils(object): "name":"dns-delegate", "type":"dns", "id": str(uuid.uuid1()), - "endpoints": { + "endpoints": [{ "interface": "public", "region": cloud_dns_delegate_info.get("cloud-region-id"), "region_id": cloud_dns_delegate_info.get("cloud-region-id"), "id": str(uuid.uuid1()), "url": multicould_namespace + "/%s/dns-delegate" % vimid, - } + }] } catalog.append(dns_catalog) -- cgit 1.2.3-korg