Fix bug of keystone v2.0 API 61/20161/3
authorBin Yang <bin.yang@windriver.com>
Mon, 23 Oct 2017 17:14:07 +0000 (01:14 +0800)
committerBin Yang <bin.yang@windriver.com>
Mon, 23 Oct 2017 17:14:07 +0000 (01:14 +0800)
Change-Id: I3683a867efc5c836b1d842dcdcd8240f4829f9f3
Issue-Id: MULTICLOUD-118
Signed-off-by: Bin Yang <bin.yang@windriver.com>
newton/newton/proxy/views/identityV3.py
newton/newton/proxy/views/proxy_utils.py

index bc2b06e..7395fac 100644 (file)
@@ -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)
 
index c80b968..68182d4 100644 (file)
@@ -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)