summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-02-09 08:15:59 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-13 14:39:26 -0800
commitbee672e5f70b3c6712280130aeb61da0674add11 (patch)
treecd2063bd000dd2902bb935d10943d96b8cfc807d
parent7b16a08989e804e857589c8a34881140150dc11c (diff)
syncdaemon: Handling of deleted symlinks (of directories). When a symlink of a directory of master is deleted. The corresponding delete in slave is handled as rmdir() of the symlink assuming the file to be directory
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2377 (gsyncd.py RepceClient: call (symlink) failed on peer with instance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2377
-rw-r--r--xlators/features/marker/utils/syncdaemon/resource.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py
index 659e344f8e1..60e32e0dc42 100644
--- a/xlators/features/marker/utils/syncdaemon/resource.py
+++ b/xlators/features/marker/utils/syncdaemon/resource.py
@@ -122,7 +122,22 @@ class Server(object):
for e in entries:
cls.purge(os.path.join(path, e))
if me_also:
- os.rmdir(path)
+ try:
+ os.rmdir(path)
+ except OSError:
+ ex = sys.exc_info()[1]
+ if ex.errno == ENOTDIR:
+ try:
+ os.unlink(path)
+ return
+ except OSError:
+ ex = sys.exc_info()[1]
+ if ex.errno != ENOENT:
+ raise
+ elif ex.errno == ENOENT:
+ logging.debug ("Trying to delete a file which is not present")
+ else:
+ raise
@classmethod
def _create(cls, path, ctor):