From 3b0778a3bf3279030b0cf40ab0b73da345ba875c Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 12 Sep 2015 19:47:11 -0400 Subject: fix for bug #5. --- combox/file.py | 15 +++++++-------- 1 file 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] -- cgit v1.2.3