From 93fb77e8afc25d5fe1452aca530ad5997bc891fd Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Fri, 28 Sep 2018 13:02:03 -0700 Subject: [PATCH] Ignore ENOENT and ENOTEMPTY errors in delete_partition This is comparable to the error handling we have in delete_handoff_objs. Change-Id: I08bda9bcfeb60b3c5654322a9e6139a8ac5b3391 --- swift/obj/replicator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index a66b5f4774..9dc7c925e2 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -576,7 +576,12 @@ class ObjectReplicator(Daemon): def delete_partition(self, path): self.logger.info(_("Removing partition: %s"), path) - tpool.execute(shutil.rmtree, path) + try: + tpool.execute(shutil.rmtree, path) + except OSError as e: + if e.errno not in (errno.ENOENT, errno.ENOTEMPTY): + # If there was a race to create or delete, don't worry + raise def delete_handoff_objs(self, job, delete_objs): success_paths = []