Fix output formatting (missing tuple).

Fix to be robust when container and object counts are None (this
happens if accounts can't be located).
This commit is contained in:
Chris Wedgwood 2011-01-18 12:08:22 -08:00
parent 5582fcd69b
commit 8a5f21b3ac

View File

@ -189,7 +189,7 @@ class Auditor(object):
self.container_obj_mismatch += 1 self.container_obj_mismatch += 1
consistent = False consistent = False
print " Different versions of %s/%s in container dbs." % \ print " Different versions of %s/%s in container dbs." % \
name, obj['name'] (name, obj['name'])
if obj['last_modified'] > rec_d[obj_name]['last_modified']: if obj['last_modified'] > rec_d[obj_name]['last_modified']:
rec_d[obj_name] = obj rec_d[obj_name] = obj
obj_counts = [int(header['x-container-object-count']) obj_counts = [int(header['x-container-object-count'])
@ -259,14 +259,16 @@ class Auditor(object):
self.account_container_mismatch += 1 self.account_container_mismatch += 1
consistent = False consistent = False
print " Account databases don't agree on number of containers." print " Account databases don't agree on number of containers."
print " Max: %s, Min: %s" % (max(cont_counts), min(cont_counts)) if cont_counts:
print " Max: %s, Min: %s" % (max(cont_counts), min(cont_counts))
obj_counts = [int(header['x-account-object-count']) obj_counts = [int(header['x-account-object-count'])
for header in headers] for header in headers]
if len(set(obj_counts)) != 1: if len(set(obj_counts)) != 1:
self.account_object_mismatch += 1 self.account_object_mismatch += 1
consistent = False consistent = False
print " Account databases don't agree on number of objects." print " Account databases don't agree on number of objects."
print " Max: %s, Min: %s" % (max(obj_counts), min(obj_counts)) if obj_counts:
print " Max: %s, Min: %s" % (max(obj_counts), min(obj_counts))
containers = set() containers = set()
for resp in responses.values(): for resp in responses.values():
containers.update(container['name'] for container in resp[1]) containers.update(container['name'] for container in resp[1])