summaryrefslogtreecommitdiffstats
path: root/share/common/msapi
diff options
context:
space:
mode:
Diffstat (limited to 'share/common/msapi')
-rw-r--r--share/common/msapi/extsys.py33
-rw-r--r--share/common/msapi/helper.py4
2 files changed, 21 insertions, 16 deletions
diff --git a/share/common/msapi/extsys.py b/share/common/msapi/extsys.py
index 88118aa8..49a2d321 100644
--- a/share/common/msapi/extsys.py
+++ b/share/common/msapi/extsys.py
@@ -46,13 +46,12 @@ def get_vim_by_id(vim_id):
status_code2, content2)
tmp_authinfo = json.JSONDecoder().decode(content2)
- # get the first auth info by default
- tmp_authinfo = tmp_authinfo['esr-system-info'][0] if tmp_authinfo \
- and tmp_authinfo.get('esr-system-info', None) else None
-
#convert vim information
- if tmp_viminfo and tmp_authinfo:
+ if tmp_viminfo and tmp_authinfo and tmp_authinfo.get('esr-system-info'):
viminfo = {}
+ # get the first auth info by default
+ tmp_authinfo = tmp_authinfo['esr-system-info'][0]
+
viminfo['vimId'] = vim_id
viminfo['resource-version'] = tmp_viminfo.get('resource-version')
viminfo['cloud_owner'] = cloud_owner
@@ -62,16 +61,22 @@ def get_vim_by_id(vim_id):
viminfo['version'] = tmp_viminfo.get('cloud-region-version')
viminfo['cloud_extra_info'] = tmp_viminfo.get('cloud-extra-info')
- viminfo['userName'] = tmp_authinfo['user-name']
- viminfo['password'] = tmp_authinfo['password']
- viminfo['domain'] = tmp_authinfo.get('cloud-domain')
- viminfo['url'] = tmp_authinfo.get('service-url')
- viminfo['tenant'] = tmp_authinfo.get('default-tenant')
- viminfo['cacert'] = tmp_authinfo.get('ssl-cacert')
- viminfo['insecure'] = tmp_authinfo.get('ssl-insecure')
+ viminfo['userName'] = tmp_authinfo.get('user-name', "")
+ viminfo['password'] = tmp_authinfo.get('password', "")
+ viminfo['domain'] = tmp_authinfo.get('cloud-domain', "")
+ viminfo['url'] = tmp_authinfo.get('service-url', "")
+ viminfo['tenant'] = tmp_authinfo.get('default-tenant', "")
+ viminfo['cacert'] = tmp_authinfo.get('ssl-cacert', "")
+ viminfo['insecure'] = tmp_authinfo.get('ssl-insecure', True)
viminfo["complex-name"] = tmp_viminfo.get("complex-name")
- viminfo['openstack_region_id'] = tmp_viminfo.get("cloud-epa-caps") \
- if tmp_viminfo.get("cloud-epa-caps") else cloud_region_id
+ # move the openstack region id store location, but keep backward compatibility
+ viminfo['openstack_region_id'] = tmp_authinfo.get("openstack-region-id") \
+ or tmp_viminfo.get("cloud-epa-caps", cloud_region_id)
+ try:
+ viminfo['cloud_extra_info_json'] = json.loads(
+ viminfo.get('cloud_extra_info', {}))
+ except Exception:
+ pass
return viminfo
return None
diff --git a/share/common/msapi/helper.py b/share/common/msapi/helper.py
index 7cfe77bd..41a9e5a6 100644
--- a/share/common/msapi/helper.py
+++ b/share/common/msapi/helper.py
@@ -90,8 +90,8 @@ class MultiCloudAAIHelper(object):
# identity service should not filtered by region since it is might be first call
# to figure out available region list
if service_type != 'identity':
- service['region_name'] = viminfo['openstack_region_id']\
- if viminfo.get('openstack_region_id') else viminfo['cloud_region_id']
+ service['region_name'] = viminfo.get('openstack_region_id') \
+ or viminfo['cloud_region_id']
self._logger.debug("making request with URI:%s,%s" % (resource_url, service))
resp = session.get(resource_url, endpoint_filter=service)