Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions mongodb_consistent_backup/Backup/Mongodump/MongodumpThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(self, state, uri, timer, config, base_dir, version, threads=0, dump

self.timer_name = "%s-%s" % (self.__class__.__name__, self.uri.replset)
self.exit_code = 1
self.error_message = None
self._command = None
self.do_stdin_passwd = False
self.stdin_passwd_sent = False
Expand Down Expand Up @@ -76,6 +77,17 @@ def handle_password_prompt(self):
self._process.stdin.flush()
self.stdin_passwd_sent = True

def is_failed_line(self, line):
if line and line.startswith("Failed: "):
return True
return False

def handle_failure(self, line):
self.error_message = line.replace("Failed: ", "").capitalize()
logging.error("Mongodump error: %s" % self.error_message)
self.exit_code = 1
self.close()

def wait(self):
try:
while self._process.stderr:
Expand All @@ -88,6 +100,9 @@ def wait(self):
continue
elif self.is_password_prompt(read):
self.handle_password_prompt()
elif self.is_failed_line(read):
self.handle_failure(read)
break
else:
logging.info(line)
if self._process.poll() != None:
Expand Down