Fixed OKA update and responses for deletion/update 20/14520/1
authoryshah <shahithya.y@tataelxsi.co.in>
Mon, 19 Aug 2024 12:49:07 +0000 (12:49 +0000)
committeryshah <shahithya.y@tataelxsi.co.in>
Mon, 19 Aug 2024 12:49:07 +0000 (12:49 +0000)
Change-Id: I49116371944e975ed21d0b3ffe0770862552a3d8
Signed-off-by: yshah <shahithya.y@tataelxsi.co.in>
osm_nbi/base_topic.py
osm_nbi/k8s_topics.py
osm_nbi/nbi.py

index 48fe1dc..252a72a 100644 (file)
@@ -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):
         """
index 2011187..8ce81f7 100644 (file)
@@ -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
index ea7a236..3728943 100644 (file)
@@ -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
                             )