Beispiel #1
0
 def create_dir_object(self, dir_path):
     # TODO: if object already exists???
     if os.path.exists(dir_path) and not os.path.isdir(dir_path):
         self.logger.error("Deleting file %s", dir_path)
         do_unlink(dir_path)
     # If dir aleady exist just override metadata.
     mkdirs(dir_path)
     do_chown(dir_path, self.uid, self.gid)
     create_object_metadata(dir_path)
     return True
Beispiel #2
0
 def create_dir_object(self, dir_path):
     #TODO: if object already exists???
     if os.path.exists(dir_path) and not os.path.isdir(dir_path):
         self.logger.error("Deleting file %s", dir_path)
         do_unlink(dir_path)
     #If dir aleady exist just override metadata.
     mkdirs(dir_path)
     do_chown(dir_path, self.uid, self.gid)
     create_object_metadata(dir_path)
     return True
Beispiel #3
0
    def unlink(self):
        """
        Remove the file.
        """
        # Marker dir.
        if self.is_dir:
            rmdirs(os.path.join(self.datadir, self.obj))
            if not os.path.isdir(os.path.join(self.datadir, self.obj)):
                self.metadata = {}
                self.data_file = None
            else:
                logging.error("Unable to delete dir %s" % os.path.join(self.datadir, self.obj))
            return

        for fname in do_listdir(self.datadir):
            if fname == self.obj:
                try:
                    do_unlink(os.path.join(self.datadir, fname))
                except OSError, err:
                    if err.errno != errno.ENOENT:
                        raise
Beispiel #4
0
    def unlink(self):
        """
        Remove the file.
        """
        #Marker dir.
        if self.is_dir:
            rmdirs(os.path.join(self.datadir, self.obj))
            if not os.path.isdir(os.path.join(self.datadir, self.obj)):
                self.metadata = {}
                self.data_file = None
            else:
                logging.error('Unable to delete dir %s' %
                              os.path.join(self.datadir, self.obj))
            return

        for fname in do_listdir(self.datadir):
            if fname == self.obj:
                try:
                    do_unlink(os.path.join(self.datadir, fname))
                except OSError, err:
                    if err.errno != errno.ENOENT:
                        raise