From bee672e5f70b3c6712280130aeb61da0674add11 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Wed, 9 Feb 2011 08:15:59 +0000 Subject: 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 Signed-off-by: Anand V. Avati 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 --- xlators/features/marker/utils/syncdaemon/resource.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'xlators/features/marker/utils/syncdaemon/resource.py') 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): -- cgit