Ejemplo n.º 1
0
    def run(self, cmd, opts, *backups):
        error = 0

        if not backups:
            LOG.info("No backupsets specified - using backupsets from %s", HOLLANDCFG.filename)
            backups = HOLLANDCFG.lookup("holland.backupsets")

        if not backups:
            LOG.warning("Nothing to purge")
            return 0

        if not opts.force:
            LOG.warning("Running in dry-run mode.  Use --execute to do a real purge.")

        for name in backups:
            if "/" not in name:
                backupset = SPOOL.find_backupset(name)
                if not backupset:
                    LOG.error("Failed to find backupset '%s'", name)
                    error = 1
                    continue
                purge_backupset(backupset, opts.force, opts.all)
            else:
                backup = SPOOL.find_backup(name)
                if not backup:
                    LOG.error("Failed to find single backup '%s'", name)
                    error = 1
                    continue
                purge_backup(backup, opts.force)
                if opts.force:
                    SPOOL.find_backupset(backup.backupset).update_symlinks()
        return error
Ejemplo n.º 2
0
    def run(self, cmd, opts, *backups):
        error = 0

        if not backups:
            LOG.info("No backupsets specified - using backupsets from %s",
                     HOLLANDCFG.filename)
            backups = HOLLANDCFG.lookup("holland.backupsets")

        if not backups:
            LOG.warning("Nothing to purge")
            return 0

        if not opts.force:
            LOG.warning(
                "Running in dry-run mode.  Use --execute to do a real purge.")

        for name in backups:
            if "/" not in name:
                backupset = SPOOL.find_backupset(name)
                if not backupset:
                    LOG.error("Failed to find backupset '%s'", name)
                    error = 1
                    continue
                purge_backupset(backupset, opts.force, opts.all)
            else:
                backup = SPOOL.find_backup(name)
                if not backup:
                    LOG.error("Failed to find single backup '%s'", name)
                    error = 1
                    continue
                purge_backup(backup, opts.force)
                if opts.force:
                    SPOOL.find_backupset(backup.backupset).update_symlinks()
        return error
Ejemplo n.º 3
0
 def run(self, cmd, opts, *args):
     backup = SPOOL.find_backup(args[0])
     if not backup:
         logging.error("No backup found named %s", args[0])
         return 1
     config = backup.config
     plugin_name = config.get('holland:backup', {}).get('plugin')
     plugin = load_first_entrypoint('holland.restore', plugin_name)(backup)
     plugin.dispatch([plugin_name] + list(args))
     return 1