fix reporting zero exit for rsync as non-zero
would give warning output like the following: /usr/local/lib/repomirror/repomirror/fetcher/rsync.py:78: UserWarning: Rsync process returned non-zero 0 (Success) for rsync --recursive --times --links --hard-links --delete-after --delay-updates --copy-links --safe-links --delete-excluded --no-motd --exclude=.* --verbose --log-file-format="[RSYNC arch.mirror.constant.com:873]:%l:%f%L" --log-file=/var/log/repo/arch.log rsync://arch.mirror.constant.com:873/archlinux/. /srv/repos/arch/.
This commit is contained in:
parent
6d384e71ae
commit
a3203ab03a
@ -11,5 +11,6 @@ RSYNC_DEF_ARGS = ['--recursive',
|
||||
'--delete-excluded',
|
||||
'--exclude=.*']
|
||||
# How many days an upstream should have last synced by before it's considered stale.
|
||||
## TODO: make this part of the upstream config? repo config?
|
||||
DAYS_WARN = 2
|
||||
VERSION = '1.0.3'
|
||||
VERSION = '1.0.4'
|
||||
|
@ -73,9 +73,18 @@ class RSync(_base.BaseFetcher):
|
||||
if stderr != '' or cmd.returncode != 0:
|
||||
rtrn = cmd.returncode
|
||||
err = rsync_returns.returns[rtrn]
|
||||
_logger.error(('Rsync to {0}:{1} returned exit status {2}: {3}').format(self.domain, self.port, rtrn, err))
|
||||
_logger.debug('STDERR: {0}'.format(stderr))
|
||||
warnings.warn('Rsync process returned non-zero {0} ({1}) for {2}'.format(rtrn, err, ' '.join(cmd_str)))
|
||||
errmsg = 'Rsync to {0}:{1} returned'.format(self.domain, self.port)
|
||||
debugmsg = 'Rsync command {0} returned'.format(' '.join(cmd_str))
|
||||
if stderr != '':
|
||||
errmsg += ' an error message: {0}'.format(stderr)
|
||||
debugmsg += ' an error message: {0}'.format(stderr)
|
||||
if rtrn != 0:
|
||||
errmsg += ' with exit status {0} ({1})'.format(rtrn, err)
|
||||
debugmsg += ' with exit status {0} ({1})'.format(rtrn, err)
|
||||
errmsg += '.'
|
||||
_logger.error(errmsg)
|
||||
_logger.debug(debugmsg)
|
||||
warnings.warn(errmsg)
|
||||
return(None)
|
||||
|
||||
def fetch_content(self, remote_filepath):
|
||||
@ -96,9 +105,18 @@ class RSync(_base.BaseFetcher):
|
||||
if stderr != '' or cmd.returncode != 0:
|
||||
rtrn = cmd.returncode
|
||||
err = rsync_returns.returns[rtrn]
|
||||
_logger.error(('Rsync to {0}:{1} returned exit status {2}: {3}').format(self.domain, self.port, rtrn, err))
|
||||
_logger.debug('STDERR: {0}'.format(stderr))
|
||||
warnings.warn('Rsync process returned non-zero {0} ({1}) for {2}'.format(rtrn, err, ' '.join(cmd_str)))
|
||||
errmsg = 'Rsync to {0}:{1} returned'.format(self.domain, self.port)
|
||||
debugmsg = 'Rsync command {0} returned'.format(' '.join(cmd_str))
|
||||
if stderr != '':
|
||||
errmsg += ' an error message: {0}'.format(stderr)
|
||||
debugmsg += ' an error message: {0}'.format(stderr)
|
||||
if rtrn != 0:
|
||||
errmsg += ' with exit status {0} ({1})'.format(rtrn, err)
|
||||
debugmsg += ' with exit status {0} ({1})'.format(rtrn, err)
|
||||
errmsg += '.'
|
||||
_logger.error(errmsg)
|
||||
_logger.debug(debugmsg)
|
||||
warnings.warn(errmsg)
|
||||
with open(tf, 'rb') as fh:
|
||||
raw_content = fh.read()
|
||||
os.remove(tf)
|
||||
|
Loading…
Reference in New Issue
Block a user