--- a/pvl/backup/rsync.py Tue Jun 19 10:35:15 2012 +0300
+++ b/pvl/backup/rsync.py Tue Jun 19 11:30:59 2012 +0300
@@ -20,17 +20,33 @@
def rsync (source, dest, **opts) :
"""
Run rsync.
+
+ Raises RsyncError if rsync fails.
+
+ XXX: never used anywhere?
"""
- invoke.command(RSYNC, source, dest, **opts)
+ try :
+ invoke.command(RSYNC, source, dest, **opts)
+
+ except invoke.InvokeError as ex :
+ raise RsyncError(ex)
class RSyncCommandFormatError (Exception) :
"""
- Improper rsync command
+ Improper rsync command/source.
"""
pass
+class RsyncError (Exception) :
+ """
+ Rsync command invocation failed.
+ """
+
+ pass
+
+
class RSyncServer (object) :
"""
rsync server-mode execution.
@@ -54,8 +70,12 @@
log.info("rsync %ss %s %s", ' '.join(options), src, dst)
- # invoke directly, no option-handling, nor stdin/out redirection
- invoke.invoke(RSYNC, options + [ src, dst ], data=False)
+ try :
+ # invoke directly, no option-handling, nor stdin/out redirection
+ invoke.invoke(RSYNC, options + [ src, dst ], data=False)
+
+ except invoke.InvokeError as ex :
+ raise RsyncError(ex)
class RSyncFSServer (RSyncServer) :
"""