def test_getBackupsForArgs_all(self):
     args = fn.parseWordArgs(["from", "all"])
     backups = fn.getBackupsForArgs(args, fn.getBackups(self._backupHome))
     self.assertEqual(
         len(backups),
         3,
         "Incorrect number of backups returned: {0}".format(len(backups)))
Exemple #2
0
def listFiles(args, settings):
    """
    Main function for the list option.
    """
    wordArgs = fn.parseWordArgs(args)
    home = fn.getBackupHome(settings.backupLocation, settings.hostName)
    backups = fn.getBackupsForArgs(wordArgs, fn.getBackups(home))
    backupWd = fn.removeAltRoot(settings.root, os.getcwd())
    for id_ in backups.keys():
        items = fn.expandGlob(home, backups[id_], backupWd, wordArgs["glob"])
        for item in items:
            _outputItemInfo(id_, fn.getInfo(item))
Exemple #3
0
def remove(args, settings):
    """
    Main function for the remove option.
    """
    wordArgs = fn.parseWordArgs(args)
    _validateArgs(wordArgs)
    home = fn.getBackupHome(settings.backupLocation, settings.hostName)
    backups = fn.getBackupsForArgs(wordArgs, fn.getBackups(home))
    backupWd = fn.removeAltRoot(settings.root, os.getcwd())
    for id_ in backups.keys():
        items = fn.expandGlob(home, backups[id_], backupWd, wordArgs["glob"])
        for item in items:
            _delete(item)
 def test_getBackupsForArgs_oneId(self):
     args = fn.parseWordArgs(["from", "backup", "2"])
     backups = fn.getBackupsForArgs(args, fn.getBackups(self._backupHome))
     self.assertEqual(backups[2], "2012-05-18-160013")