-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Hi all,
I think it's good to add opcode for notification in configdb.py to verify the difference between these:
"AAA": null
"AAA": {}
So I want to contribute a PR with this patch as bellow, but I have no access for push and merge PR? How to deal with this?
commit f547f9c02347e7b42962278005bcba973892a18b
Author: sam <[email protected]>
Date: Tue Nov 27 11:31:27 2018 +0800
add opcode in redis notification
diff --git a/src/swsssdk/configdb.py b/src/swsssdk/configdb.py
index e255979..87cad6e 100644
--- a/src/swsssdk/configdb.py
+++ b/src/swsssdk/configdb.py
@@ -76,10 +76,10 @@ class ConfigDBConnector(SonicV2Connector):
if self.handlers.has_key(table):
self.handlers.pop(table)
- def __fire(self, table, key, data):
+ def __fire(self, table, key, data, op_str='add'):
if self.handlers.has_key(table):
handler = self.handlers[table]
- handler(table, key, data)
+ handler(table, key, data, op_str)
def listen(self):
"""Start listen Redis keyspace events and will trigger corresponding handlers when content of a table changes.
@@ -94,7 +94,11 @@ class ConfigDBConnector(SonicV2Connector):
if self.handlers.has_key(table):
client = self.redis_clients[self.CONFIG_DB]
data = self.__raw_to_typed(client.hgetall(key))
- self.__fire(table, row, data)
+ op = client.keys(key)
+ op_str = 'add'
+ if len(op) == 0:
+ op_str = 'del'
+ self.__fire(table, row, data, op_str)
except ValueError:
pass #Ignore non table-formated redis entries
Metadata
Metadata
Assignees
Labels
No labels