Example #1
0
 def meta_del(self):
     
     if os.path.exists(self.metafile):
         do_unlink(self.metafile)
         
         if dir_empty(self.meta_fhr_path):
             rmdirs(self.meta_fhr_path)
Example #2
0
 def create_dir_object(self, dir_path):
     
     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)
    
     mkdirs(dir_path)
     do_chown(dir_path, self.uid, self.gid)
     
     return True
Example #3
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)

        return True
Example #4
0
    def meta_unlink(self):
        """
        Remove the file.
        """
        
        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
Example #5
0
 def meta_del(self):
     
     if os.path.exists(self.metafile):
         do_unlink(self.metafile)