summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/utils/syncdaemon/resource.py
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/marker/utils/syncdaemon/resource.py')
-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 659e344f8..60e32e0dc 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):