File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,20 @@ def close(self):
2727 return self .connection .close ()
2828
2929 def get_rs_status (self ):
30- try :
31- tries = 0
32- status = None
33- while not status and tries < self . retries :
30+ tries = 0
31+ status = None
32+ while not status and tries < self . retries :
33+ try :
3434 status = self .connection ['admin' ].command ("replSetGetStatus" )
35- tries = tries + 1
35+ if not status :
36+ raise e
37+ except Exception , e :
38+ logging .debug ("Error running command 'replSetGetStatus': %s" % e )
39+ tries = tries + 1
3640 sleep (1 )
37- if not status :
38- raise Exception , "Could not get output from command: 'replSetGetStatus' after %i retries!" % self .retries , None
39- return status
40- except Exception , e :
41- logging .fatal ("Failed to execute 'replSetGetStatus' command! Error: %s" % e )
42- raise e
41+ if not status :
42+ raise Exception , "Could not get output from command: 'replSetGetStatus' after %i retries!" % self .retries , None
43+ return status
4344
4445 def find_desirable_secondary (self ):
4546 rs_status = self .get_rs_status ()
@@ -53,7 +54,7 @@ def find_desirable_secondary(self):
5354 member ['stateStr' ],
5455 rs_name ,
5556 member ['name' ],
56- str (member ['optime' ])
57+ str (member ['optime' ][ 'ts' ] )
5758 ))
5859
5960 if member ['stateStr' ] == 'PRIMARY' :
You can’t perform that action at this time.
0 commit comments