def checkForDeleteOldest(commandArgs, bkHome): """ Check if the option to delete the oldest backup was provided, and delete the oldest backup. """ if commandArgs.deleteOldest: if len(fn.getBackups(bkHome)) > 1: fn.deleteBackup(bkHome, fn.getOldestBackup(bkHome)) raise CleanExitException()
def test_getOldestBackup(self): oldest = fn.getOldestBackup(self._backupHome) self.assertEqual( oldest, "2012-01-25-120729", "Incorrect oldest backup returned: {0}".format(oldest))