(self, checkData)
return status.returncode == 0
Check the backup consistency
Check the backup consistency
Check the backup consistency
def checkBackup(self, checkData):
        """Check the backup consistency"""

        # Use the passphrase saved
        os.environ["BORG_PASSPHRASE"] = self.key

        # Standard check
        args = [ 'borg', 'check', '--info' ]

        # Finally add the repository path
        args.append(self.repositoryPath)

        ## Should we check the data as well
        if checkData == True:
            args.append('--verify-data')

        # Star the process and keep stdout / stderr
        status = self.runCommand(args, "Checking repository")

        if status.returncode == 0:
            self.lastBackupInfo['check'] = "Check status:\n"
        else:
            self.lastBackupInfo['check'] = "Check errors:\n"

        # Save details for reporting
        if status.stdout != None:
            self.lastBackupInfo['check'] += status.stdout
        if status.stderr != None:
            self.lastBackupInfo['check'] += status.stderr

        # If not, raise an exception to avoid writing files in a directory
        # that is not a repository
        if status.returncode != 0:
            logging.error("Error when checking backup: " + status.stderr)
            raise RuntimeError(status.stderr)

        return status.returncode == 0
def checkBackup ( self , checkData ) : # Use the passphrase saved os . environ [ "BORG_PASSPHRASE" ] = self . key # Standard check args = [ 'borg' , 'check' , '--info' ] # Finally add the repository path args . append ( self . repositoryPath ) ## Should we check the data as well if checkData == True : args . append ( '--verify-data' ) # Star the process and keep stdout / stderr status = self . runCommand ( args , "Checking repository" ) if status . returncode == 0 : self . lastBackupInfo [ 'check' ] = "Check status:\n" else : self . lastBackupInfo [ 'check' ] = "Check errors:\n" # Save details for reporting if status . stdout != None : self . lastBackupInfo [ 'check' ] += status . stdout if status . stderr != None : self . lastBackupInfo [ 'check' ] += status . stderr # If not, raise an exception to avoid writing files in a directory # that is not a repository if status . returncode != 0 : logging . error ( "Error when checking backup: " + status . stderr ) raise RuntimeError ( status . stderr ) return status . returncode == 0