コード例 #1
0
ファイル: survey_endpoint.py プロジェクト: rmenn/cassback
    def remove_file(self, relative_path, dry_run=False):

        path = os.path.join(self.args.meta_dir, relative_path)
        restore_file = self.read_backup_file(relative_path)

        if dry_run:
            return path

        # If no size do not add to the survey,
        # it's probably not a file with meta data.
        # e.g. we are deleting a manifest
        if size is not None:
            msg = self.FILE_OP_PATTERN.format(
                time=dt_util.now_iso(),
                action="removed",
                src_path=relative_path,
                dest_path="na",
                bytes=restore_file.component.stat.size)

            self.log_file.write(msg)
            self.log_file.flush()

        os.remove(path)
        file_util.maybe_remove_dirs(os.path.dirname(path))
        return relative_path
コード例 #2
0
    def remove_file(self, relative_path, dry_run=False):

        full_path = os.path.join(self.args.backup_base, relative_path)

        if dry_run:
            return full_path

        os.remove(full_path)
        file_util.maybe_remove_dirs(os.path.dirname(full_path))
        return full_path
コード例 #3
0
ファイル: local_endpoint.py プロジェクト: DashHunter/cassback
 def remove_file(self, relative_path, dry_run=False):
     
     full_path = os.path.join(self.args.backup_base, relative_path)
     
     if dry_run:
         return full_path
         
     os.remove(full_path)
     file_util.maybe_remove_dirs(os.path.dirname(full_path))
     return full_path
コード例 #4
0
 def remove_file(self, relative_path, dry_run=False):
     
     path = os.path.join(self.args.meta_dir, relative_path)
     restore_file = self.read_backup_file(relative_path)
     
     if dry_run:
         return path
         
     # If no size do not add to the survey, 
     # it's probably not a file with meta data.
     # e.g. we are deleting a manifest
     if size is not None:
         msg = self.FILE_OP_PATTERN.format(time=dt_util.now_iso(), 
             action="removed", src_path=relative_path, 
             dest_path="na", 
             bytes=restore_file.component.stat.size)
         
         self.log_file.write(msg)
         self.log_file.flush()
     
     os.remove(path)
     file_util.maybe_remove_dirs(os.path.dirname(path))
     return relative_path