[svn r38038] more precise rsyncing

--HG--
branch : trunk
This commit is contained in:
hpk 2007-02-06 22:41:11 +01:00
parent c888d05772
commit 89a14afcbe
3 changed files with 14 additions and 7 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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)