diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index 020bfc95cd..c06586c079 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -274,14 +274,9 @@ class ObjectReplicator(Daemon): all(responses) if not suffixes or delete_handoff: if delete_objs: - self.logger.info(_("Removing %s objecs"), + self.logger.info(_("Removing %s objects"), len(delete_objs)) - delete_objs = [ - storage_directory(job['obj_path'], - job['partition'], - object_hash) - for object_hash in delete_objs] - self.delete_handoff_paths(delete_objs) + self.delete_handoff_objs(job, delete_objs) else: self.logger.info(_("Removing partition: %s"), job['path']) tpool.execute( @@ -292,8 +287,10 @@ class ObjectReplicator(Daemon): self.partition_times.append(time.time() - begin) self.logger.timing_since('partition.delete.timing', begin) - def delete_handoff_paths(self, paths): - for object_path in paths: + def delete_handoff_objs(self, job, delete_objs): + for object_hash in delete_objs: + object_path = storage_directory(job['obj_path'], job['partition'], + object_hash) tpool.execute(shutil.rmtree, object_path, ignore_errors=True) suffix_dir = dirname(object_path) try: diff --git a/test/unit/obj/test_replicator.py b/test/unit/obj/test_replicator.py index 0417194cd4..47288b9ed2 100644 --- a/test/unit/obj/test_replicator.py +++ b/test/unit/obj/test_replicator.py @@ -684,7 +684,7 @@ class TestObjectReplicator(unittest.TestCase): self.call_nums = 0 self.conf['sync_method'] = 'ssync' - def _fake_ssync(node, job, suffixes): + def _fake_ssync(node, job, suffixes, **kwags): success = False ret_val = [] if self.call_nums == 2: