aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client
diff options
context:
space:
mode:
Diffstat (limited to 'onap-client/onap_client')
-rw-r--r--onap-client/onap_client/sdc/service.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/onap-client/onap_client/sdc/service.py b/onap-client/onap_client/sdc/service.py
index 1bccb36..05ccbeb 100644
--- a/onap-client/onap_client/sdc/service.py
+++ b/onap-client/onap_client/sdc/service.py
@@ -402,13 +402,18 @@ def get_service_id(service_name, oc=None):
if not oc:
oc = Client()
- response = oc.sdc.service.get_service_by_name_version(
- catalog_service_name=service_name,
- catalog_service_version="1.0",
- raise_on_error=False,
- attempts=1,
- )
- if not response.success:
+ try:
+ response = oc.sdc.service.get_service_by_name_version(
+ catalog_service_name=service_name,
+ catalog_service_version="1.0",
+ attempts=1,
+ )
+ except Exception as e:
+ if str(e).lower().find("service was not found") != -1:
+ services = oc.sdc.service.get_services().response_data.get("services", [])
+ for service in services:
+ if service.get("name") == service_name:
+ return service.get("uniqueId"), service
return None, None
versions = response.response_data.get("allVersions")