From 75492bd3d301b62308bdc9ae4d787344d68e942c Mon Sep 17 00:00:00 2001 From: shrinithi Date: Fri, 21 Mar 2025 18:37:44 +0000 Subject: [PATCH] Cluster deletion status code fix Change-Id: I2a341e5957b78a31c5e8eebfe8195812c43fe632 Signed-off-by: shrinithi --- osm_nbi/k8s_topics.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osm_nbi/k8s_topics.py b/osm_nbi/k8s_topics.py index 6898498..20bd76f 100644 --- a/osm_nbi/k8s_topics.py +++ b/osm_nbi/k8s_topics.py @@ -60,7 +60,7 @@ class InfraContTopic(ProfileTopic): schema_edit = infra_controller_profile_create_edit_schema def __init__(self, db, fs, msg, auth): - BaseTopic.__init__(self, db, fs, msg, auth) + super().__init__(db, fs, msg, auth) def new(self, rollback, session, indata=None, kwargs=None, headers=None): # To create the new infra controller profile @@ -82,7 +82,7 @@ class InfraConfTopic(ProfileTopic): schema_edit = infra_config_profile_create_edit_schema def __init__(self, db, fs, msg, auth): - BaseTopic.__init__(self, db, fs, msg, auth) + super().__init__(db, fs, msg, auth) def new(self, rollback, session, indata=None, kwargs=None, headers=None): # To create the new infra config profile @@ -104,7 +104,7 @@ class AppTopic(ProfileTopic): schema_edit = app_profile_create_edit_schema def __init__(self, db, fs, msg, auth): - BaseTopic.__init__(self, db, fs, msg, auth) + super().__init__(db, fs, msg, auth) def new(self, rollback, session, indata=None, kwargs=None, headers=None): # To create the new app profile @@ -126,7 +126,7 @@ class ResourceTopic(ProfileTopic): schema_edit = resource_profile_create_edit_schema def __init__(self, db, fs, msg, auth): - BaseTopic.__init__(self, db, fs, msg, auth) + super().__init__(db, fs, msg, auth) def new(self, rollback, session, indata=None, kwargs=None, headers=None): # To create the new resource profile @@ -556,12 +556,14 @@ class ClusterTopic(ACMTopic): filter_q = self._get_project_filter(session) filter_q[self.id_field(self.topic, _id)] = _id check = self.db.get_one(self.topic, filter_q) + op_id = check["current_operation"] if check["created"] == "false": raise EngineException( "Cannot delete registered cluster. Please deregister.", HTTPStatus.UNPROCESSABLE_ENTITY, ) super().delete(session, _id, dry_run, not_send_msg) + return op_id class ClusterOpsTopic(ACMTopic): @@ -775,7 +777,7 @@ class ClusterOpsTopic(ACMTopic): {"cluster_id": _id, "operation_id": op_id}, not_send_msg=not_send_msg, ) - return None + return _id class KsusTopic(ACMTopic): -- 2.25.1