Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

63 lines (55 sloc) 1.934 kb
import os
import textwrap
from holland.core.command import Command, option
from holland.core.spool import spool
from holland.core.config import hollandcfg
from holland.core.plugin import load_backup_plugin
class ListBackups(Command):
Lists available backups
name = 'list-backups'
aliases = [
description = 'List available backups'
options = [
option('-v', '--verbose', action='store_true',
help="Verbose output")
def print_table(self, table):
header = table[0]
rest = table[1:]
fmt = "%-28s %-9s %-16s %s"
print fmt % tuple(header)
print "-"*80
for row in rest:
print fmt % tuple(row)
def run(self, cmd, opts):
backup_list = [x for x in spool.list_backups()]
if not backup_list:
print "No backups"
return 0
backupsets_seen = []
for backup in backup_list:
if backup.backupset not in backupsets_seen:
print "Backupset[%s]:" % (backup.backupset)
# Read the backup.conf
plugin_name = backup.config.get('holland:backup', {})['plugin']
if not plugin_name:
print "Skipping broken backup: %s" %
print "\t%s" %
if opts.verbose:
print "\t",
plugin = load_backup_plugin(plugin_name)
plugin = plugin(backup.backupset, backup.config, backup.path)
if hasattr(plugin, 'info'):
plugin_info =
import re
rec = re.compile(r'^', re.M)
print rec.sub('\t\t', plugin_info)
return 0
Jump to Line
Something went wrong with that request. Please try again.