Skip to content

Commit

Permalink
Fix a bug in idempotent check. (sonic-net#755)
Browse files Browse the repository at this point in the history
Currently it misses the case where data for a new key is empty.
  • Loading branch information
renukamanavalan authored Nov 27, 2019
1 parent 1898102 commit 0f43c16
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/configlet
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,16 @@ def init():
def db_update(t, k, lst):
init()
to_upd = False
data = db.get_entry(t, k)
for i in lst.keys():
if not data.has_key(i) or data[i] != lst[i]:
to_upd = True
break
ct_keys = db.get_keys(t)
tuple_k = db.deserialize_key(k[0])
if tuple_k in ct_keys:
data = db.get_entry(t, k)
for i in lst.keys():
if not data.has_key(i) or data[i] != lst[i]:
to_upd = True
break
else:
to_upd = True

if to_upd:
db.mod_entry(t, k, lst)
Expand Down

0 comments on commit 0f43c16

Please sign in to comment.