def run_rsync(self):
cmd = self.generate_rsync_command()
logger.info('Running %s: %s', self.friendly_name, ' '.join(cmd))
# Close all DB connections before continuing with the rsync
# command. Since it may take a while, the connection could get
# dropped and we'd have issues later on.
connections.close_all()
try:
output = check_output(cmd).decode('utf-8')
returncode = 0
except CalledProcessError as e:
returncode, output = e.returncode, e.output
errstr = RSYNC_EXITCODES.get(returncode, 'Return code not matched')
logging.warning(
'code: %s\nmsg: %s\nexception: %s', returncode, errstr, str(e))
if returncode not in RSYNC_HARMLESS_EXITCODES:
raise
logger.info(
'Rsync exited with code %s for %s. Output: %s',
returncode, self.friendly_name, output)
评论列表
文章目录