Beispiel #1
0
def checkForClean(commandArgs, bkHome, writer):
    """
    If the clean option is given, delete any backups marked for deletion,
    then exit.
    """
    if commandArgs.clean:
        maint.deleteBackupsMarkedForDeletion(bkHome, writer)
        raise CleanExitException()
Beispiel #2
0
def runMaintenanceFunctions(bkHome, settings, outputWriter):
    """
    Execute maintenance functions that are intended to be ran after a
    successful backup has been performed.
    """
    settings.reduceBackups and organize(bkHome)
    settings.keepDays and maint.checkForKeepDays(bkHome, settings.keepDays)
    settings.maxImages and maint.checkMaxImages(bkHome, settings.maxImages)
    maint.deleteBackupsMarkedForDeletion(bkHome, outputWriter)
 def test_deleteBackupsMarkedForDeletion(self):
     fst = join(self._backupHome, os.listdir(self._backupHome)[0])
     os.rename(fst, fst + ".delete")
     maint.deleteBackupsMarkedForDeletion(
         self._backupHome,
         lambda x: x)
     self.assertEqual(
         self.getNonDeleteCount(),
         2,
         "Wrong number of backups deleted.")