Commit cca4978e authored by owsla's avatar owsla

Allow --test-server to be combined with --restrict again.


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@1049 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 56833b85
New in v1.2.9 (????/??/??)
---------------------------
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.2.8 (2009/03/16)
---------------------------
......
......@@ -288,7 +288,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)
......
......@@ -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")
......
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