From e330184a81a453780deca68afd6e764c0eb00109 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Mon, 9 Aug 2021 14:33:22 -0700 Subject: [VVP] suport for service version <1.0 Issue-ID: VVP-556 Signed-off-by: stark, steven Change-Id: Ibce73608fe73d241cb6038ab4efa1fe00e5dbac0 --- onap-client/onap_client/sdc/service.py | 19 ++++++++++++------- onap-client/setup.py | 2 +- 2 files changed, 13 insertions(+), 8 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") diff --git a/onap-client/setup.py b/onap-client/setup.py index 1b34a09..b849344 100644 --- a/onap-client/setup.py +++ b/onap-client/setup.py @@ -43,7 +43,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="onap-client", - version="1.5.4", + version="1.5.5", author="Steven Stark", author_email="steven.stark@att.com", description="Python API wrapper for ONAP applications", -- cgit 1.2.3-korg