[cedar-backup-svn] SF.net SVN: cedar-backup: [838] cedar-backup2/trunk
Brought to you by:
pronovic
|
From: <pro...@us...> - 2007-12-20 01:42:33
|
Revision: 838
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=838&view=rev
Author: pronovic
Date: 2007-12-19 17:42:31 -0800 (Wed, 19 Dec 2007)
Log Message:
-----------
Improve managed action error handling
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/cli.py
cedar-backup2/trunk/CedarBackup2/peer.py
cedar-backup2/trunk/Changelog
Modified: cedar-backup2/trunk/CedarBackup2/cli.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/cli.py 2007-12-19 16:17:27 UTC (rev 837)
+++ cedar-backup2/trunk/CedarBackup2/cli.py 2007-12-20 01:42:31 UTC (rev 838)
@@ -448,9 +448,14 @@
"""
Executes the managed action associated with an item.
- @note: Only options.full is actually used. The rest of
- the arguments exist to satisfy the ActionItem iterface.
+ @note: Only options.full is actually used. The rest of the arguments
+ exist to satisfy the ActionItem iterface.
+ @note: Errors here result in a message logged to ERROR, but no thrown
+ exception. The analogy is the stage action where a problem with one host
+ should not kill the entire backup. Since we're logging an error, the
+ administrator will get an email.
+
@param configPath: Path to configuration file on disk.
@param options: Command-line options to be passed to action.
@param config: Parsed configuration to be passed to action.
@@ -459,7 +464,10 @@
"""
for peer in self.remotePeers:
logger.debug("Executing managed action [%s] on peer [%s]." % (self.name, peer.name))
- peer.executeManagedAction(self.name, options.full)
+ try:
+ peer.executeManagedAction(self.name, options.full)
+ except IOError, e:
+ logger.error(e) # log the message and go on, so we don't kill the backup
###################
Modified: cedar-backup2/trunk/CedarBackup2/peer.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/peer.py 2007-12-19 16:17:27 UTC (rev 837)
+++ cedar-backup2/trunk/CedarBackup2/peer.py 2007-12-20 01:42:31 UTC (rev 838)
@@ -857,8 +857,12 @@
@raise IOError: If there is an error executing the action on the remote peer.
"""
- command = RemotePeer._buildCbackCommand(self.cbackCommand, action, fullBackup)
- self.executeRemoteCommand(command)
+ try:
+ command = RemotePeer._buildCbackCommand(self.cbackCommand, action, fullBackup)
+ self.executeRemoteCommand(command)
+ except IOError, e:
+ logger.info(e)
+ raise IOError("Failed to execute action [%s] on managed client [%s]." % (action, self.name))
##################
@@ -1160,21 +1164,21 @@
@raise IOError: If there is an error executing the remote command
"""
+ actualCommand = "%s %s@%s '%s'" % (rshCommand, remoteUser, remoteHost, remoteCommand)
if localUser is not None:
try:
if os.getuid() != 0:
raise IOError("Only root can remote shell as another user.")
except AttributeError: pass
command = resolveCommand(SU_COMMAND)
- actualCommand = "%s %s@%s '%s'" % (rshCommand, remoteUser, remoteHost, remoteCommand)
result = executeCommand(command, [localUser, "-c", actualCommand])[0]
if result != 0:
- raise IOError("Error (%d) executing command on remote host as local user [%s]." % (result, localUser))
+ raise IOError("Command failed [su -c %s \"%s\"]" % (localUser, actualCommand))
else:
command = resolveCommand(rshCommandList)
result = executeCommand(command, ["%s@%s" % (remoteUser, remoteHost), "%s" % remoteCommand])[0]
if result != 0:
- raise IOError("Error (%d) executing command on remote host (using no local user)." % result)
+ raise IOError("Command failed [%s]" % (actualCommand))
_executeRemoteCommand = staticmethod(_executeRemoteCommand)
def _buildCbackCommand(cbackCommand, action, fullBackup):
Modified: cedar-backup2/trunk/Changelog
===================================================================
--- cedar-backup2/trunk/Changelog 2007-12-19 16:17:27 UTC (rev 837)
+++ cedar-backup2/trunk/Changelog 2007-12-20 01:42:31 UTC (rev 838)
@@ -1,3 +1,8 @@
+Version 2.15.1 19 Dec 2007
+
+ * Improve error reporting for managed client action failures.
+ * Make sure that managed client failure does not kill entire backup.
+
Version 2.15.0 18 Dec 2007
* Minor documentation tweaks discovered during 3.0 development.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|