Commit 00f4b61c authored by ben's avatar ben

Improved error reporting when rdiff-backup doesn't start correctly on

the remote side.


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@27 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent a320fcea
......@@ -7,6 +7,7 @@ import types, os, tempfile, cPickle, shutil, traceback
#
class ConnectionError(Exception): pass
class ConnectionReadError(ConnectionError): pass
class ConnectionQuit(Exception): pass
......@@ -210,8 +211,9 @@ class LowLevelPipeConnection(Connection):
def _get(self):
"""Read an object from the pipe and return (req_num, value)"""
header_string = self.inpipe.read(9)
assert len(header_string) == 9, \
"Error reading from pipe (problem probably originated remotely)"
if not len(header_string) == 9:
raise ConnectionReadError("Truncated header string (problem "
"probably originated remotely)")
try:
format_string, req_num, length = (header_string[0],
ord(header_string[1]),
......
......@@ -7,6 +7,7 @@ import types, os, tempfile, cPickle, shutil, traceback
#
class ConnectionError(Exception): pass
class ConnectionReadError(ConnectionError): pass
class ConnectionQuit(Exception): pass
......@@ -210,8 +211,9 @@ class LowLevelPipeConnection(Connection):
def _get(self):
"""Read an object from the pipe and return (req_num, value)"""
header_string = self.inpipe.read(9)
assert len(header_string) == 9, \
"Error reading from pipe (problem probably originated remotely)"
if not len(header_string) == 9:
raise ConnectionReadError("Truncated header string (problem "
"probably originated remotely)")
try:
format_string, req_num, length = (header_string[0],
ord(header_string[1]),
......
......@@ -109,15 +109,26 @@ class SetConnections:
conn_number = len(Globals.connections)
conn = PipeConnection(stdout, stdin, conn_number)
cls.check_connection_version(conn)
cls.check_connection_version(conn, remote_cmd)
Log("Registering connection %d" % conn_number, 7)
cls.init_connection_routing(conn, conn_number, remote_cmd)
cls.init_connection_settings(conn)
return conn
def check_connection_version(cls, conn):
def check_connection_version(cls, conn, remote_cmd):
"""Log warning if connection has different version"""
remote_version = conn.Globals.get('version')
try: remote_version = conn.Globals.get('version')
except ConnectionReadError, exception:
Log.FatalError("""%s
Couldn't start up the remote connection by executing
%s
Remember that, under the default settings, rdiff-backup must be
installed in the PATH on the remote system. See the man page for more
information.""" % (exception, remote_cmd))
if remote_version != Globals.version:
Log("Warning: Local version %s does not match remote version %s."
% (Globals.version, remote_version), 2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment