From: yshah Date: Fri, 17 Jan 2025 04:05:45 +0000 (+0000) Subject: OKA update check conflict on name and description X-Git-Tag: v18.0.0~46 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F14882%2F7;p=osm%2FNBI.git OKA update check conflict on name and description Change-Id: I44eaa83a15ae8386dfe470f0c06a3264538b87e0 Signed-off-by: yshah --- diff --git a/osm_nbi/k8s_topics.py b/osm_nbi/k8s_topics.py index 9519f2d..d4ff80b 100644 --- a/osm_nbi/k8s_topics.py +++ b/osm_nbi/k8s_topics.py @@ -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):