parent
c888d05772
commit
89a14afcbe
|
@ -94,7 +94,6 @@ class HostRSync(py.execnet.RSync):
|
||||||
if finishedcallback:
|
if finishedcallback:
|
||||||
finishedcallback()
|
finishedcallback()
|
||||||
return False
|
return False
|
||||||
reporter(repevent.HostRSyncing(host))
|
|
||||||
self._synced[key] = True
|
self._synced[key] = True
|
||||||
# the follow attributes are set from host.initgateway()
|
# the follow attributes are set from host.initgateway()
|
||||||
gw = host.gw
|
gw = host.gw
|
||||||
|
@ -104,7 +103,7 @@ class HostRSync(py.execnet.RSync):
|
||||||
super(HostRSync, self).add_target(gw,
|
super(HostRSync, self).add_target(gw,
|
||||||
remotepath,
|
remotepath,
|
||||||
finishedcallback)
|
finishedcallback)
|
||||||
return True # added the target
|
return remotepath
|
||||||
|
|
||||||
class HostManager(object):
|
class HostManager(object):
|
||||||
def __init__(self, config, hosts=None):
|
def __init__(self, config, hosts=None):
|
||||||
|
@ -136,8 +135,9 @@ class HostManager(object):
|
||||||
for host in self.hosts:
|
for host in self.hosts:
|
||||||
def donecallback():
|
def donecallback():
|
||||||
reporter(repevent.HostRSyncRootReady(host, root))
|
reporter(repevent.HostRSyncRootReady(host, root))
|
||||||
rsync.add_target_host(host, reporter, destrelpath,
|
remotepath = rsync.add_target_host(
|
||||||
finishedcallback=donecallback)
|
host, reporter, destrelpath, finishedcallback=donecallback)
|
||||||
|
reporter(repevent.HostRSyncing(host, root, remotepath))
|
||||||
rsync.send(root)
|
rsync.send(root)
|
||||||
|
|
||||||
def setup_hosts(self, reporter):
|
def setup_hosts(self, reporter):
|
||||||
|
|
|
@ -74,8 +74,10 @@ class CallFinish(CallEvent):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class HostRSyncing(ReportEvent):
|
class HostRSyncing(ReportEvent):
|
||||||
def __init__(self, host):
|
def __init__(self, host, root, remotepath):
|
||||||
self.host = host
|
self.host = host
|
||||||
|
self.root = root
|
||||||
|
self.remotepath = remotepath
|
||||||
|
|
||||||
class HostGatewayReady(ReportEvent):
|
class HostGatewayReady(ReportEvent):
|
||||||
def __init__(self, host, roots):
|
def __init__(self, host, roots):
|
||||||
|
|
|
@ -58,8 +58,13 @@ class AbstractReporter(object):
|
||||||
|
|
||||||
def report_HostRSyncing(self, item):
|
def report_HostRSyncing(self, item):
|
||||||
hostrepr = self._hostrepr(item.host)
|
hostrepr = self._hostrepr(item.host)
|
||||||
print "%15s: RSYNC ==> %s" % (hostrepr,
|
if not item.remotepath:
|
||||||
item.host.relpath)
|
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):
|
def report_HostGatewayReady(self, item):
|
||||||
self.to_rsync[item.host] = len(item.roots)
|
self.to_rsync[item.host] = len(item.roots)
|
||||||
|
|
Loading…
Reference in New Issue