diff options
author | stark, steven <steven.stark@att.com> | 2021-08-09 14:33:22 -0700 |
---|---|---|
committer | stark, steven <steven.stark@att.com> | 2021-08-09 14:39:37 -0700 |
commit | e330184a81a453780deca68afd6e764c0eb00109 (patch) | |
tree | a02a75431bb652fc50f326fd73ae32a538749968 /onap-client/onap_client/sdc/service.py | |
parent | 76a0639fc26652c9ed8ba5e573b16c2495313e47 (diff) |
[VVP] suport for service version <1.0istanbul
Issue-ID: VVP-556
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: Ibce73608fe73d241cb6038ab4efa1fe00e5dbac0
Diffstat (limited to 'onap-client/onap_client/sdc/service.py')
-rw-r--r-- | onap-client/onap_client/sdc/service.py | 19 |
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") |