Call SDC APIs via https
[modeling/etsicatalog.git] / catalog / pub / msapi / sdc.py
index bb473cc..86930f0 100644 (file)
@@ -30,7 +30,7 @@ DISTRIBUTED = "DISTRIBUTED"
 
 def call_sdc(resource, method, content=''):
     additional_headers = {
-        'X-ECOMP-InstanceID': 'VFC',
+        'X-ECOMP-InstanceID': 'Modeling',
     }
     return restcall.call_req(base_url=SDC_BASE_URL,
                              user=SDC_USER,
@@ -90,6 +90,8 @@ def get_asset(asset_type, uuid):
         logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
         raise CatalogException("Failed to get asset(%s, %s) from sdc." % (asset_type, uuid))
     asset = json.JSONDecoder().decode(ret[1])
+    if len(asset) == 0:
+        raise CatalogException("Failed to get asset(%s, %s) from sdc." % (asset_type, uuid))
     if asset.get("distributionStatus", None) != DISTRIBUTED:
         raise CatalogException("The asset (%s,%s) is not distributed from sdc." % (asset_type, uuid))
     else: