Loading src/adapters/tf_adapter/application_onboarding_management.py +12 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,8 @@ def delete_app(federation_context_id, app_id, bearer_token=None, partner_api_roo # Check if there are application deployments dependents of the onboarding if check_child_onboarding(federation_context_id, app_id): raise APIError(409, "Unable to remove application. There are running instances. Remove them and try again ") # Clean up stale deployment bookkeeping records so onboarding can be removed _prune_orphan_deployment_records(federation_context_id, app_id) # Delete onboarding at edgecloud_client try: Loading Loading @@ -468,6 +469,16 @@ def fill_update_application_onboarding_mongo_document(body, originating_ao_insta return onboarding_update_data def _prune_orphan_deployment_records(federation_context_id, app_id): """Remove deployment bookkeeping records that have no live instances.""" originating_ad_objects = OriginatingApplicationDeploymentManagement.objects( orig_ad_federation_context_id=federation_context_id, orig_ad_app_id=app_id ) if originating_ad_objects: originating_ad_objects.delete() def check_child_onboarding(federation_context_id, app_id): found = False Loading Loading
src/adapters/tf_adapter/application_onboarding_management.py +12 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,8 @@ def delete_app(federation_context_id, app_id, bearer_token=None, partner_api_roo # Check if there are application deployments dependents of the onboarding if check_child_onboarding(federation_context_id, app_id): raise APIError(409, "Unable to remove application. There are running instances. Remove them and try again ") # Clean up stale deployment bookkeeping records so onboarding can be removed _prune_orphan_deployment_records(federation_context_id, app_id) # Delete onboarding at edgecloud_client try: Loading Loading @@ -468,6 +469,16 @@ def fill_update_application_onboarding_mongo_document(body, originating_ao_insta return onboarding_update_data def _prune_orphan_deployment_records(federation_context_id, app_id): """Remove deployment bookkeeping records that have no live instances.""" originating_ad_objects = OriginatingApplicationDeploymentManagement.objects( orig_ad_federation_context_id=federation_context_id, orig_ad_app_id=app_id ) if originating_ad_objects: originating_ad_objects.delete() def check_child_onboarding(federation_context_id, app_id): found = False Loading