Skip to content
Snippets Groups Projects
Commit 92dd6d7f authored by Alex ubuntu vm's avatar Alex ubuntu vm
Browse files

BUG FIX: Database not updated when node is not present

parent 47dfaac7
No related branches found
No related tags found
1 merge request!2repo: added new directory where utils scripts will be
...@@ -105,7 +105,7 @@ def update_db(body, logger, annotations, **kwargs): ...@@ -105,7 +105,7 @@ def update_db(body, logger, annotations, **kwargs):
if 'status' in body and 'podIP' in body['status']: if 'status' in body and 'podIP' in body['status']:
db = pymysql.connect(host=databaseIP,user="l2sm",password="l2sm;",db="L2SM") db = pymysql.connect(host=databaseIP,user="l2sm",password="l2sm;",db="L2SM")
cur = db.cursor() 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) cur.execute(updateQuery)
db.commit() db.commit()
db.close() db.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment