OKA update check conflict on name and description
Change-Id: I44eaa83a15ae8386dfe470f0c06a3264538b87e0
Signed-off-by: yshah <shahithya.y@tataelxsi.co.in>
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
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 @@
)
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):