From ffcac5fb35d261da764b9179d74b1d2bdadd9992 Mon Sep 17 00:00:00 2001 From: yshah Date: Mon, 19 Aug 2024 12:49:07 +0000 Subject: [PATCH] Fixed OKA update and responses for deletion/update Change-Id: I49116371944e975ed21d0b3ffe0770862552a3d8 Signed-off-by: yshah --- osm_nbi/base_topic.py | 2 +- osm_nbi/k8s_topics.py | 11 +++++------ osm_nbi/nbi.py | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/osm_nbi/base_topic.py b/osm_nbi/base_topic.py index 48fe1dc..252a72a 100644 --- a/osm_nbi/base_topic.py +++ b/osm_nbi/base_topic.py @@ -924,7 +924,7 @@ class BaseTopic: self.db.del_one(self.topic, filter_q) self.delete_extra(session, _id, item_content, not_send_msg=not_send_msg) self._send_msg("deleted", {"_id": _id}, not_send_msg=not_send_msg) - return None + return _id def edit(self, session, _id, indata=None, kwargs=None, content=None): """ diff --git a/osm_nbi/k8s_topics.py b/osm_nbi/k8s_topics.py index 2011187..8ce81f7 100644 --- a/osm_nbi/k8s_topics.py +++ b/osm_nbi/k8s_topics.py @@ -79,7 +79,7 @@ class InfraContTopic(BaseTopic): self.detach(session, _id, profile_type="infra_controller_profiles") # To delete the infra controller profile super().delete(session, _id, not_send_msg=not_send_msg) - return + return _id class InfraConfTopic(BaseTopic): @@ -110,7 +110,7 @@ class InfraConfTopic(BaseTopic): self.detach(session, _id, profile_type="infra_config_profiles") # To delete the infra config profile super().delete(session, _id, not_send_msg=not_send_msg) - return + return _id class AppTopic(BaseTopic): @@ -141,7 +141,7 @@ class AppTopic(BaseTopic): self.detach(session, _id, profile_type="app_profiles") # To delete the app profile super().delete(session, _id, not_send_msg=not_send_msg) - return + return _id class ResourceTopic(BaseTopic): @@ -152,7 +152,6 @@ class ResourceTopic(BaseTopic): def __init__(self, db, fs, msg, auth): BaseTopic.__init__(self, db, fs, msg, auth) - # self.logger = logging.getLogger("nbi.k8s_topics") def new(self, rollback, session, indata=None, kwargs=None, headers=None): # To create the new resource profile @@ -173,7 +172,7 @@ class ResourceTopic(BaseTopic): self.detach(session, _id, profile_type="resource_profiles") # To delete the resource profile super().delete(session, _id, not_send_msg=not_send_msg) - return + return _id class K8sTopic(BaseTopic): @@ -832,7 +831,6 @@ class KsusTopic(BaseTopic): data = {"ksus_list": _id_list, "operation_id": op_id} self._send_msg("edit", data) - return op_id def edit_ksu(self, session, _id, op_id, indata, kwargs): content = None @@ -1024,6 +1022,7 @@ class OkaTopic(DescriptorTopic): self._send_msg( "delete", {"oka_id": _id, "operation_id": op_id}, not_send_msg=not_send_msg ) + return op_id def new(self, rollback, session, indata=None, kwargs=None, headers=None): # _remove_envelop diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index ea7a236..3728943 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -2133,7 +2133,7 @@ class Server(object): engine_session, engine_topic, _id, None, kwargs ) if indata: - if indata.get("name") or indata.get("description"): + if isinstance(indata, dict): op_id = self.engine.edit_item( engine_session, engine_topic, _id, indata, kwargs ) -- 2.25.1