From 92dd6d7f503263ee26389e816f311b364acab6c2 Mon Sep 17 00:00:00 2001
From: Alex ubuntu vm <alexdecb@yahoo.es>
Date: Fri, 17 Nov 2023 12:19:52 +0100
Subject: [PATCH] BUG FIX: Database not updated when node is not present

---
 operator/src/operator/l2sm-operator.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/operator/src/operator/l2sm-operator.py b/operator/src/operator/l2sm-operator.py
index 0d87886..b8eef08 100644
--- a/operator/src/operator/l2sm-operator.py
+++ b/operator/src/operator/l2sm-operator.py
@@ -105,7 +105,7 @@ def update_db(body, logger, annotations, **kwargs):
     if 'status' in body and 'podIP' in body['status']:
       db = pymysql.connect(host=databaseIP,user="l2sm",password="l2sm;",db="L2SM")
       cur = db.cursor()
-      updateQuery = "UPDATE switches SET ip = '%s' WHERE node = '%s'" % (body['status']['podIP'], body['spec']['nodeName'])
+      updateQuery = "UPDATE switches SET ip = '%s', OpenFlowId = NULL WHERE node = '%s'" % (body['status']['podIP'], body['spec']['nodeName'])
       cur.execute(updateQuery)
       db.commit()
       db.close()
-- 
GitLab