=== modified file 'lava_dashboard_tool/commands.py'
@@ -802,16 +802,20 @@
else:
local_bundles = [bundle for bundle in self.server.bundles(stream["pathname"])]
remote_bundles = [bundle for bundle in self.remote_server.bundles(stream["pathname"])]
- missing_bundles = set((bundle["content_sha1"] for bundle in remote_bundles)) - set((bundle["content_sha1"] for bundle in local_bundles))
+ missing_bundles = set((bundle["content_sha1"] for bundle in remote_bundles))
+ missing_bundles -= set((bundle["content_sha1"] for bundle in local_bundles))
try:
- missing_bytes = sum((bundle["content_size"] for bundle in remote_bundles if bundle["content_sha1"] in missing_bundles))
+ missing_bytes = sum(
+ (bundle["content_size"]
+ for bundle in remote_bundles
+ if bundle["content_sha1"] in missing_bundles))
except KeyError as ex:
# Older servers did not return content_size so this part is optional
missing_bytes = None
if missing_bytes:
print "Stream %s needs update (%s)" % (stream["pathname"], self._filesizeformat(missing_bytes))
elif missing_bundles:
- print "Stream %s needs update" % (stream["pathname"],)
+ print "Stream %s needs update (no estimate available)" % (stream["pathname"],)
else:
print "Stream %s is up to date" % (stream["pathname"],)
for content_sha1 in missing_bundles:
@@ -820,8 +824,15 @@
data = self.remote_server.get(content_sha1)
print "got %s, storing" % (self._filesizeformat(len(data["content"]))),
sys.stdout.flush()
- self.server.put(data["content"], data["content_filename"], stream["pathname"])
- print "done"
+ try:
+ self.server.put(data["content"], data["content_filename"], stream["pathname"])
+ except xmlrpclib.Fault as ex:
+ if ex.faultCode == 409: # duplicate
+ print "already present (in another stream)"
+ else:
+ raise
+ else:
+ print "done"
class data_views(ExperimentalCommandMixIn, XMLRPCCommand):