From 89a14afcbe93e5914cf546a8b76b46b782af3cee Mon Sep 17 00:00:00 2001 From: hpk Date: Tue, 6 Feb 2007 22:41:11 +0100 Subject: [PATCH] [svn r38038] more precise rsyncing --HG-- branch : trunk --- py/test/rsession/hostmanage.py | 8 ++++---- py/test/rsession/repevent.py | 4 +++- py/test/rsession/reporter.py | 9 +++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/py/test/rsession/hostmanage.py b/py/test/rsession/hostmanage.py index becc9a060..e7ac8dcb1 100644 --- a/py/test/rsession/hostmanage.py +++ b/py/test/rsession/hostmanage.py @@ -94,7 +94,6 @@ class HostRSync(py.execnet.RSync): if finishedcallback: finishedcallback() return False - reporter(repevent.HostRSyncing(host)) self._synced[key] = True # the follow attributes are set from host.initgateway() gw = host.gw @@ -104,7 +103,7 @@ class HostRSync(py.execnet.RSync): super(HostRSync, self).add_target(gw, remotepath, finishedcallback) - return True # added the target + return remotepath class HostManager(object): def __init__(self, config, hosts=None): @@ -136,8 +135,9 @@ class HostManager(object): for host in self.hosts: def donecallback(): reporter(repevent.HostRSyncRootReady(host, root)) - rsync.add_target_host(host, reporter, destrelpath, - finishedcallback=donecallback) + remotepath = rsync.add_target_host( + host, reporter, destrelpath, finishedcallback=donecallback) + reporter(repevent.HostRSyncing(host, root, remotepath)) rsync.send(root) def setup_hosts(self, reporter): diff --git a/py/test/rsession/repevent.py b/py/test/rsession/repevent.py index d2bfa67dc..7992dadd6 100644 --- a/py/test/rsession/repevent.py +++ b/py/test/rsession/repevent.py @@ -74,8 +74,10 @@ class CallFinish(CallEvent): pass class HostRSyncing(ReportEvent): - def __init__(self, host): + def __init__(self, host, root, remotepath): self.host = host + self.root = root + self.remotepath = remotepath class HostGatewayReady(ReportEvent): def __init__(self, host, roots): diff --git a/py/test/rsession/reporter.py b/py/test/rsession/reporter.py index 6d0f6806a..f9726af14 100644 --- a/py/test/rsession/reporter.py +++ b/py/test/rsession/reporter.py @@ -58,8 +58,13 @@ class AbstractReporter(object): def report_HostRSyncing(self, item): hostrepr = self._hostrepr(item.host) - print "%15s: RSYNC ==> %s" % (hostrepr, - item.host.relpath) + if not item.remotepath: + print "%15s: skip duplicate rsync of %r" % ( + hostrepr, item.root.basename) + else: + print "%15s: rsync %r to remote %s" % (hostrepr, + item.root.basename, + item.remotepath) def report_HostGatewayReady(self, item): self.to_rsync[item.host] = len(item.roots)