summaryrefslogtreecommitdiffstats
path: root/ocata/ocata/vesagent/vesagent_ctrl.py
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-07-04 18:19:30 +0800
committerYun Huang <yun.huang@windriver.com>2018-07-04 18:19:30 +0800
commit05a53c33b1bcd3c778757d0c507424688c7f4ce8 (patch)
tree52a501253a595b4e6f774156fb1a34da6dcc4b3e /ocata/ocata/vesagent/vesagent_ctrl.py
parent7671ba36f568d10da7c4febed40ce0ab1325f3fd (diff)
Fix bugs for GET API and tasks for ocata
Change-Id: Ica14eb1cc8735f7cbae8b5226f8630c79317d2e7 Issue-ID: Issue-ID: MULTICLOUD-232 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'ocata/ocata/vesagent/vesagent_ctrl.py')
-rw-r--r--ocata/ocata/vesagent/vesagent_ctrl.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ocata/ocata/vesagent/vesagent_ctrl.py b/ocata/ocata/vesagent/vesagent_ctrl.py
index 43d1ffb7..8e5af243 100644
--- a/ocata/ocata/vesagent/vesagent_ctrl.py
+++ b/ocata/ocata/vesagent/vesagent_ctrl.py
@@ -164,10 +164,15 @@ class VesAgentCtrl(APIView):
self._logger.debug("with META: %s" % request.META)
try:
# get vesagent_config from cloud region
- viminfo = extsys.get_vim_by_id(vimid)
- cloud_extra_info_str = viminfo.get('cloud_extra_info', None)
- cloud_extra_info = json.loads(cloud_extra_info_str) if cloud_extra_info_str is not None else None
- vesagent_config = cloud_extra_info.get("vesagent_config", None) if cloud_extra_info is not None else None
+ try:
+ viminfo = extsys.get_vim_by_id(vimid)
+ cloud_extra_info_str = viminfo.get('cloud_extra_info', '')
+ cloud_extra_info = json.loads(cloud_extra_info_str) if cloud_extra_info_str != '' else None
+ vesagent_config = cloud_extra_info.get("vesagent_config", None) if cloud_extra_info is not None else None
+ except Exception as e:
+ #ignore this error
+ self._logger.warn("cloud extra info is provided with data in bad format: %s" % cloud_extra_info_str)
+ pass
vesagent_backlogs = self.getBacklogsOneVIM(vimid)
@@ -363,7 +368,6 @@ class VesAgentCtrl(APIView):
if VesAgentBacklogsVimListStr is not None:
VesAgentBacklogsVimList = json.loads(VesAgentBacklogsVimListStr)
VesAgentBacklogsVimList = [v for v in VesAgentBacklogsVimList if v != vimid]
- VesAgentBacklogsVimList = self.vimid_
VesAgentBacklogsVimList.append(vimid)
logger.info("VesAgentBacklogs.vimlist is %s" % VesAgentBacklogsVimList)