|
From: <di...@us...> - 2010-11-23 01:39:03
|
Revision: 720
http://safekeep.svn.sourceforge.net/safekeep/?rev=720&view=rev
Author: dimi
Date: 2010-11-23 01:38:57 +0000 (Tue, 23 Nov 2010)
Log Message:
-----------
Proper reporting of client stacktraces to the server.
Fix the invocation of ssh(1) when we don't have verosity enabled.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-23 01:00:17 UTC (rev 719)
+++ safekeep/trunk/safekeep 2010-11-23 01:38:57 UTC (rev 720)
@@ -75,6 +75,14 @@
# Miscellaneous support functions
######################################################################
+class ClientException(Exception):
+ def __init__(self, value, traceback=None):
+ self.value = value
+ self.traceback = traceback
+
+ def __str__(self):
+ return repr(self.value)
+
def send(msg):
print msg.encode('utf-8')
sys.stdout.flush()
@@ -885,11 +893,10 @@
if line.startswith('OK'):
return line[2:-1].strip()
elif line.startswith('ERROR'):
- raise Exception(line[5:].strip())
+ raise ClientException(line[5:].strip())
elif line.startswith('TRACEBACK'):
i = line.find('>>>')
- error(line[i+3:].replace('###', '\n'))
- raise Exception(line[10:i].strip())
+ raise ClientException(line[10:i].strip(), line[i+3:].replace('###', '\n'))
elif not line:
raise Exception('client died unexpectedly')
else:
@@ -1035,7 +1042,9 @@
cmd = []
if cfg['host']:
- cmd.extend(['ssh', verbosity_ssh, '-T', '-i', cfg['key_ctrl'], '-l', cfg['user'], cfg['host']])
+ cmd.extend(['ssh'])
+ if verbosity_ssh: cmd.extend([verbosity_ssh])
+ cmd.extend(['-T', '-i', cfg['key_ctrl'], '-l', cfg['user'], cfg['host']])
cmd.extend(['safekeep', '--client'])
(cin,cout) = os.popen2(cmd)
@@ -1102,7 +1111,11 @@
info('Client-side cleanup for client %s: FAILED' % id)
do_server_rdiff_cleanup(cfg)
else:
- error('Server backup for client %s: FAILED' % id, ex)
+ if isinstance(ex, ClientException):
+ error('Client %s: FAILED due to: %s' % (id, ex or ''))
+ if ex.traceback: error(ex.traceback)
+ else:
+ error('Server backup for client %s: FAILED' % id, ex)
info('------------------------------------------------------------------')
debug('Server backup done')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|