diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2021-02-08 17:24:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-02-08 17:24:58 +0000 |
commit | 1a5df3ce215a5502ff8e1045915e598ffada41c6 (patch) | |
tree | 284aaddcd73b8a5926289c3e0f072a8ffb0b13f5 /src/onaptests/steps/cloud/register_cloud.py | |
parent | ba1faac52b28f752516ab075a5bda56058548e49 (diff) | |
parent | df5a03610d6f00ed8e8ee3e153de055fbc5dae94 (diff) |
Merge "Python SDK 7.4.0 compatibility"
Diffstat (limited to 'src/onaptests/steps/cloud/register_cloud.py')
-rw-r--r-- | src/onaptests/steps/cloud/register_cloud.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/onaptests/steps/cloud/register_cloud.py b/src/onaptests/steps/cloud/register_cloud.py index 72da4f7..58c3e35 100644 --- a/src/onaptests/steps/cloud/register_cloud.py +++ b/src/onaptests/steps/cloud/register_cloud.py @@ -4,6 +4,7 @@ from uuid import uuid4 from onapsdk.aai.cloud_infrastructure import CloudRegion from onapsdk.configuration import settings +from onapsdk.exceptions import ResourceNotFound from ..base import BaseStep from onaptests.steps.cloud.cloud_region_create import CloudRegionCreateStep @@ -45,11 +46,11 @@ class RegisterCloudRegionStep(BaseStep): - TENANT_NAME. """ super().execute() - cloud_region: CloudRegion = CloudRegion.get_by_id( - cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER, - cloud_region_id=settings.CLOUD_REGION_ID, - ) - if not list(cloud_region.esr_system_infos): + try: + cloud_region: CloudRegion = CloudRegion.get_by_id( + cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER, + cloud_region_id=settings.CLOUD_REGION_ID) + except ResourceNotFound: cloud_region.add_esr_system_info( esr_system_info_id=str(uuid4()), user_name=settings.VIM_USERNAME, @@ -78,7 +79,7 @@ class RegisterCloudRegionStep(BaseStep): # if it does not exist, create it try: cloud_region.get_tenant(settings.TENANT_ID) - except ValueError: + except ResourceNotFound: self._logger.warning("Impossible to retrieve the Specificed Tenant") self._logger.debug("If no multicloud selected, add the tenant") cloud_region.add_tenant( @@ -90,7 +91,7 @@ class RegisterCloudRegionStep(BaseStep): try: cloud_region.get_availability_zone_by_name( settings.AVAILABILITY_ZONE_NAME) - except ValueError: + except ResourceNotFound: cloud_region.add_availability_zone( settings.AVAILABILITY_ZONE_NAME, settings.AVAILABILITY_ZONE_TYPE) |