From 336f5ebeadaa05b01b6756c4a9424e5000861d2e Mon Sep 17 00:00:00 2001 From: owsla Date: Fri, 27 Mar 2009 21:31:11 +0000 Subject: Allow --test-server to be used with --restrict again. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@1050 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 7 +++++++ rdiff-backup/rdiff_backup/Main.py | 2 +- rdiff-backup/rdiff_backup/SetConnections.py | 13 +++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 57e59c8..7a654c5 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,3 +1,10 @@ +New in v1.3.4 (????/??/??) +--------------------------- + +Allow --test-server option to be combined with --restrict. Thanks to Nick +Moffitt for reporting the error. Closes Ubuntu bug #349072. (Andrew Ferguson) + + New in v1.3.3 (2009/03/16) --------------------------- diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index d111dc9..a8bc1dc 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -290,7 +290,7 @@ def take_action(rps): elif action == "remove-older-than": RemoveOlderThan(rps[0]) elif action == "restore": Restore(*rps) elif action == "restore-as-of": Restore(rps[0], rps[1], 1) - elif action == "test-server": SetConnections.TestConnections() + elif action == "test-server": SetConnections.TestConnections(rps) elif action == "verify": Verify(rps[0]) else: raise AssertionError("Unknown action " + action) diff --git a/rdiff-backup/rdiff_backup/SetConnections.py b/rdiff-backup/rdiff_backup/SetConnections.py index d4e1a59..793674c 100644 --- a/rdiff-backup/rdiff_backup/SetConnections.py +++ b/rdiff-backup/rdiff_backup/SetConnections.py @@ -241,19 +241,24 @@ def CloseConnections(): Globals.backup_reader = Globals.isbackup_reader = \ Globals.backup_writer = Globals.isbackup_writer = None -def TestConnections(): +def TestConnections(rpaths): """Test connections, printing results""" if len(Globals.connections) == 1: print "No remote connections specified" else: - for i in range(1, len(Globals.connections)): test_connection(i) + assert len(Globals.connection) == len(rpaths) + 1 + for i in range(1, len(Globals.connections)): + test_connection(i, rpaths[i-1]) -def test_connection(conn_number): +def test_connection(conn_number, rp): """Test connection. conn_number 0 is the local connection""" print "Testing server started by: ", __conn_remote_cmds[conn_number] conn = Globals.connections[conn_number] try: assert conn.Globals.get('current_time') is None - assert type(conn.os.listdir('.')) is list + try: + assert type(conn.os.getuid()) is int + except AttributeError: # Windows doesn't support os.getuid() + assert type(conn.os.listdir(rp.path)) is list version = conn.Globals.get('version') except: sys.stderr.write("Server tests failed\n") -- cgit v1.2.1