diff options
| -rw-r--r-- | xlators/features/marker/utils/syncdaemon/resource.py | 17 | 
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):  | 
