From 6c45b36e0e2923422fe9e116f517a3af7ecb4b37 Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Mon, 21 Dec 2015 20:29:15 -0500 Subject: Now use `os.renames` instead `os.rename` function. --- ChangeLog | 9 +++++++++ combox/events.py | 2 +- combox/file.py | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65cf4ae..29e2f6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2015-12-21 Siddharth Ravikumar + + * combox/events.py (NodeDirMonitor.on_moved): Now uses + `os.renames` function instead `os.rename` to create intermediate + directories if they're non-existent. + * combox/file.py (move_nodedir, move_shards): Now uses + `os.renames` function instead `os.rename` to create intermediate + directories if they're non-existent. + 2015-12-21 Siddharth Ravikumar commit 8c86e7c28738c66c0e04ae7886b44dbcdfc6369e diff --git a/combox/events.py b/combox/events.py index be37337..fa238ee 100644 --- a/combox/events.py +++ b/combox/events.py @@ -506,7 +506,7 @@ class NodeDirMonitor(LoggingEventHandler): return else: try: - os.rename(src_cb_path, dest_cb_path) + os.renames(src_cb_path, dest_cb_path) except OSError, e: log_e("Jeez, failed to rename path. %r" % e) self.silo.node_rem(silo_node_dict, src_cb_path) diff --git a/combox/file.py b/combox/file.py index b02c1ab..2f65e05 100644 --- a/combox/file.py +++ b/combox/file.py @@ -200,7 +200,7 @@ def move_nodedir(src, dest, config): src_dir_path = path.join(node, src_rel_path) dest_dir_path = path.join(node, dest_rel_path) try: - os.rename(src_dir_path, dest_dir_path) + os.renames(src_dir_path, dest_dir_path) except OSError, e: log_e("Error when trying to rename %s -> %s" % (src_dir_path, dest_dir_path)) @@ -267,7 +267,7 @@ def move_shards(src, dest, config): dest_shard = "%s.shard%s" % (path.join(node, dest_rel_path), shard_no) try: - os.rename(src_shard, dest_shard) + os.renames(src_shard, dest_shard) except OSError, e: log_e("Error when trying to rename shard %s -> %s" % (src_shard, dest_shard)) -- cgit v1.2.3