summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup
diff options
context:
space:
mode:
authorowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-01-08 21:03:44 +0000
committerowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-01-08 21:03:44 +0000
commit3987342fa7111df672240bd7289ffad1005690e5 (patch)
treeec613ac17c4b956dc5c1c8b3081d956bd6e2399e /rdiff-backup/rdiff_backup
parent1986e8f698b346f0ff35b272aeea0258a6c640b7 (diff)
downloadrdiff-backup-3987342fa7111df672240bd7289ffad1005690e5.tar.gz
Print more helpful error messages when the remote command cannot be started
on Windows. Fix --test-server option when used with remote Windows clients. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r1-2@1011 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup')
-rw-r--r--rdiff-backup/rdiff_backup/SetConnections.py18
-rw-r--r--rdiff-backup/rdiff_backup/connection.py2
2 files changed, 12 insertions, 8 deletions
diff --git a/rdiff-backup/rdiff_backup/SetConnections.py b/rdiff-backup/rdiff_backup/SetConnections.py
index d61a65f..d4e1a59 100644
--- a/rdiff-backup/rdiff_backup/SetConnections.py
+++ b/rdiff-backup/rdiff_backup/SetConnections.py
@@ -119,7 +119,10 @@ def parse_file_desc(file_desc):
def fill_schema(host_info):
"""Fills host_info into the schema and returns remote command"""
- return __cmd_schema % host_info
+ try:
+ return __cmd_schema % host_info
+ except TypeError:
+ Log.FatalError("Invalid remote schema:\n\n%s\n" % __cmd_schema)
def init_connection(remote_cmd):
"""Run remote_cmd, register connection, and then return it
@@ -134,10 +137,13 @@ def init_connection(remote_cmd):
Log("Executing " + remote_cmd, 4)
if os.name == "nt":
import subprocess
- process = subprocess.Popen(remote_cmd, shell=False, bufsize=0,
+ try:
+ process = subprocess.Popen(remote_cmd, shell=False, bufsize=0,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
- (stdin, stdout) = (process.stdin, process.stdout)
+ (stdin, stdout) = (process.stdin, process.stdout)
+ except OSError:
+ (stdin, stdout) = (None, None)
else:
stdin, stdout = os.popen2(remote_cmd)
conn_number = len(Globals.connections)
@@ -152,7 +158,7 @@ def init_connection(remote_cmd):
def check_connection_version(conn, remote_cmd):
"""Log warning if connection has different version"""
try: remote_version = conn.Globals.get('version')
- except connection.ConnectionReadError, exception:
+ except connection.ConnectionError, exception:
Log.FatalError("""%s
Couldn't start up the remote connection by executing
@@ -247,9 +253,7 @@ def test_connection(conn_number):
conn = Globals.connections[conn_number]
try:
assert conn.Globals.get('current_time') is None
- assert type(conn.os.name) is str
- if (conn.os.name != 'nt'):
- assert type(conn.os.getuid()) is int
+ assert type(conn.os.listdir('.')) is list
version = conn.Globals.get('version')
except:
sys.stderr.write("Server tests failed\n")
diff --git a/rdiff-backup/rdiff_backup/connection.py b/rdiff-backup/rdiff_backup/connection.py
index 2fbe8ea..7799585 100644
--- a/rdiff-backup/rdiff_backup/connection.py
+++ b/rdiff-backup/rdiff_backup/connection.py
@@ -203,7 +203,7 @@ class LowLevelPipeConnection(Connection):
C.long2str(long(len(data))))
self.outpipe.write(data)
self.outpipe.flush()
- except IOError: raise ConnectionWriteError()
+ except (IOError, AttributeError): raise ConnectionWriteError()
def _read(self, length):
"""Read length bytes from inpipe, returning result"""