Пример #1
0
 def delete(self):
     if self.empty():
         #For delete account.
         if os.path.ismount(self.datadir):
             clean_metadata(self.datadir)
         else:
             rmdirs(self.datadir)
         self.dir_exists = False
Пример #2
0
 def delete(self):
     if self.empty():
         #For delete account.
         if os.path.ismount(self.datadir):
             clean_metadata(self.datadir)
         else:
             rmdirs(self.datadir)
         self.dir_exists = False
Пример #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
Пример #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
Пример #5
0
    def unlinkold(self, timestamp):
        """
        Remove any older versions of the object file.  Any file that has an
        older timestamp than timestamp will be deleted.

        :param timestamp: timestamp to compare with each file
        """
        if not self.metadata or self.metadata['X-Timestamp'] >= timestamp:
            return

        assert self.data_file, \
            "Have metadata, %r, but no data_file" % self.metadata

        if self._is_dir:
            # Marker directory object
            if not rmdirs(self.data_file):
                logging.error('Unable to delete dir object: %s', self.data_file)
                return
        else:
            # File object
            do_unlink(self.data_file)

        self.metadata = {}
        self.data_file = None
Пример #6
0
 def unlink(self):
     """
     Remove directory/container if empty.
     """
     if dir_empty(self.datadir):
         rmdirs(self.datadir)
Пример #7
0
 def unlink(self):
     """
     Remove directory/container if empty.
     """
     if dir_empty(self.datadir):
         rmdirs(self.datadir)