summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-01-27 21:54:21 -0500
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-01-27 21:54:21 -0500
commitba9d681cde57eb053042153ff6a3855ffb57d698 (patch)
tree28fad349cfe4f40127f0cbdab15560f3e7e51bdc
parent646696e364b70e9c2b388d17522463c103130e38 (diff)
[bug fix] combox/file.py: rm_shards function checks if a shard exists before os.remove()ing it.
-rw-r--r--combox/file.py8
1 files changed, 7 insertions, 1 deletions
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: