OKA update check conflict on name and description 82/14882/7
authoryshah <shahithya.y@tataelxsi.co.in>
Fri, 17 Jan 2025 04:05:45 +0000 (04:05 +0000)
committeryshah <shahithya.y@tataelxsi.co.in>
Tue, 28 Jan 2025 11:37:44 +0000 (11:37 +0000)
Change-Id: I44eaa83a15ae8386dfe470f0c06a3264538b87e0
Signed-off-by: yshah <shahithya.y@tataelxsi.co.in>
osm_nbi/k8s_topics.py

index 9519f2d..d4ff80b 100644 (file)
@@ -1038,16 +1038,24 @@ class OkaTopic(DescriptorTopic, ACMOperationTopic):
             )
 
     def check_conflict_on_edit(self, session, final_content, edit_content, _id):
-        if (
-            final_content["name"] == edit_content["name"]
+        if "name" in edit_content:
+            if final_content["name"] == edit_content["name"]:
+                name = edit_content["name"]
+                raise EngineException(
+                    f"No update, new name for the OKA is the same: {name}",
+                    http_code=HTTPStatus.CONFLICT,
+                )
+            else:
+                self.check_unique_name(session, edit_content["name"])
+        elif (
+            "description" in edit_content
             and final_content["description"] == edit_content["description"]
         ):
+            description = edit_content["description"]
             raise EngineException(
-                "No update",
+                f"No update, new description for the OKA is the same: {description}",
                 http_code=HTTPStatus.CONFLICT,
             )
-        if final_content["name"] != edit_content["name"]:
-            self.check_unique_name(session, edit_content["name"])
         return final_content
 
     def edit(self, session, _id, indata=None, kwargs=None, content=None):