summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <rsiddharth@ninthfloor.org>2015-09-12 19:47:11 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-09-12 19:51:36 -0400
commit3b0778a3bf3279030b0cf40ab0b73da345ba875c (patch)
tree3e8a4800ca598a683a9673411073edbd7c1e15eb
parent80c565a0840d674addd31250c3eecdafdc31a33c (diff)
fix for bug #5.
-rw-r--r--combox/file.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/combox/file.py b/combox/file.py
index a8e345b..c70e11e 100644
--- a/combox/file.py
+++ b/combox/file.py
@@ -247,11 +247,6 @@ def move_shards(src, dest, config):
config: a dictionary containing configuration info about combox.
"""
- if path.basename(src) == path.basename(dest):
- # this means the parent directory was rename, no the file
- # itself! So we don't have to do anything.
- return
-
nodes = get_nodedirs(config)
src_rel_path = relative_path(src, config)
@@ -259,9 +254,13 @@ def move_shards(src, dest, config):
for node in nodes:
src_shard_glob = "%s.shard*" % path.join(node, src_rel_path)
- # there's always only one shard in each node directory. So,
- # the glob() will alawys return a list of size 1.
- src_shard = glob(src_shard_glob)[0]
+ # there's always only one shard in each node directory.
+ glob_list = glob(src_shard_glob)
+ if glob_list:
+ src_shard = glob_list[0]
+ else:
+ # shards are not there!, so we return.
+ return
# get shard number
shard_no = src_shard.partition('.shard')[2]