@@ -245,20 +245,24 @@ def run(self):
245245 except Exception , e :
246246 logging .exception ("Error performing mongodump: %s" % e )
247247
248- try :
249- oplog = Oplog (self .oplog_file , self .dump_gzip )
250- oplog .load ()
251- except Exception , e :
252- logging .exception ("Error loading oplog: %s" % e )
248+ oplog = None
249+ if self .oplog_enabled_parse ():
250+ try :
251+ oplog = Oplog (self .oplog_file , self .dump_gzip )
252+ oplog .load ()
253+ except Exception , e :
254+ logging .exception ("Error loading oplog: %s" % e )
253255
254256 self .state .set ('running' , False )
255257 self .state .set ('completed' , True )
256- self .state .set ('count' , oplog .count ())
257- self .state .set ('first_ts' , oplog .first_ts ())
258- self .state .set ('last_ts' , oplog .last_ts ())
258+ if self .oplog_enabled_parse ():
259+ self .state .set ('count' , oplog .count ())
260+ self .state .set ('first_ts' , oplog .first_ts ())
261+ self .state .set ('last_ts' , oplog .last_ts ())
259262 self .timer .stop (self .timer_name )
260263
261- log_msg_extra = "%i oplog changes" % oplog .count ()
262- if oplog .last_ts ():
263- log_msg_extra = "%s, end ts: %s" % (log_msg_extra , oplog .last_ts ())
264+ if self .oplog_enabled_parse ():
265+ log_msg_extra = "%i oplog changes" % oplog .count ()
266+ if oplog .last_ts ():
267+ log_msg_extra = "%s, end ts: %s" % (log_msg_extra , oplog .last_ts ())
264268 logging .info ("Backup %s completed in %.2f seconds, %s" % (self .uri , self .timer .duration (self .timer_name ), log_msg_extra ))
0 commit comments