From ba9d681cde57eb053042153ff6a3855ffb57d698 Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Tue, 27 Jan 2015 21:54:21 -0500 Subject: [bug fix] combox/file.py: rm_shards function checks if a shard exists before os.remove()ing it. --- combox/file.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/combox/file.py b/combox/file.py index e4677e9..0eb08b3 100644 --- a/combox/file.py +++ b/combox/file.py @@ -116,9 +116,15 @@ def rm_shards(fpath, config): for node in nodes: shard_glob = "%s.shard*" % path.join(node, rel_path) + + shard_glob = glob(shard_glob) + if not len(shard_glob): + # shard was already deleted. + continue + # there's always only one shard in each node directory. So, # the glob() will alawys return a list of size 1. - shard = glob(shard_glob)[0] + shard = shard_glob[0] try: os.remove(shard) except OSError, e: -- cgit v1.2.3