Skip to content

Commit ff5b704

Browse files
author
Tim Vaillancourt
committed
you're not allowed to check if a dict field exists if the var is not a dict
1 parent 35bfccc commit ff5b704

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

MongoBackup/ReplsetHandler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def find_desirable_secondary(self):
5656
'optime': member['optimeDate']
5757
}
5858
optime = member['optime']
59-
if 'ts' in member['optime']:
59+
if isinstance(member['optime'], dict) and 'ts' in member['optime']:
6060
optime = member['optime']['ts']
6161
logging.debug("Found PRIMARY: %s/%s with optime %s" % (
6262
rs_name,
@@ -102,7 +102,7 @@ def find_desirable_secondary(self):
102102
log_msg = "Found SECONDARY %s/%s with too-high replication lag! Skipping" % (rs_name, member['name'])
103103

104104
log_data['optime'] = member['optime']
105-
if 'ts' in member['optime']:
105+
if isinstance(member['optime'], dict) and 'ts' in member['optime']:
106106
log_data['optime'] = member['optime']['ts']
107107
log_data['score'] = int(score)
108108
logging.debug("%s: %s" % (log_msg, str(log_data)))

0 commit comments

Comments
 (0)