# HG changeset patch # User Tero Marttila # Date 1330700984 -7200 # Node ID 6070507e09ce945bb3bbe1544e714f51841db220 # Parent b6c0bdd6d8d45c927300746d96fc62cd13b6b190 change rsync-snapshot.conf to use [foo/bar] syntax, because diff -r b6c0bdd6d8d4 -r 6070507e09ce rsync-snapshot.conf --- a/rsync-snapshot.conf Fri Mar 02 16:59:14 2012 +0200 +++ b/rsync-snapshot.conf Fri Mar 02 17:09:44 2012 +0200 @@ -11,43 +11,43 @@ delete = true ## Intervals -[intervals:recent] +[intervals/recent] format = keep = 4 -[intervals:day] +[intervals/day] format = %Y-%m-%d keep = 7 -[intervals:week] +[intervals/week] format = %Y-%W keep = 4 -[intervals:month] +[intervals/month] format = %Y-%m keep = 4 -[intervals:year] +[intervals/year] format = %Y keep = 1 ## Targets -[targets:test] +[targets/test] path = ./test source = /srv/lvm-test/ -[targets:test:intervals] +[targets/test/intervals] recent = 4 day = 7 -[targets:test:rsync_options] +[targets/test/rsync_options] exclude-from = ignore.list -[targets:test-lvm] +[targets/test-lvm] path = ./test-lvm source = backups_test:lvm:asdf:test -[targets:test-lvm:intervals] +[targets/test-lvm/intervals] recent = 4 diff -r b6c0bdd6d8d4 -r 6070507e09ce scripts/pvlbackup-rsync-snapshot --- a/scripts/pvlbackup-rsync-snapshot Fri Mar 02 16:59:14 2012 +0200 +++ b/scripts/pvlbackup-rsync-snapshot Fri Mar 02 17:09:44 2012 +0200 @@ -21,7 +21,7 @@ log = logging.getLogger() -# command-line options +# command-line options, global state options = None def parse_options (argv, defaults) : @@ -146,7 +146,12 @@ log.debug("section: %s", section_name) # subsections - section_path = section_name.split(':') + if ':' in section_name : + # legacy! + section_path = section_name.split(':') + else : + # new! shiny! + section_path = section_name.split('/') # lookup section dict from config lookup = config @@ -295,7 +300,7 @@ try : base = options.intervals[interval] except KeyError: - raise ConfigError("Unknown interval for [target:{target}]: {interval}".format(target=name, interval=interval)) + raise ConfigError("Unknown interval for [target/{target}]: {interval}".format(target=name, interval=interval)) # parse yield Interval.from_target_config(interval, base, arg) @@ -312,7 +317,7 @@ rsync_options = None, ) : if not source and source is not False : - raise ConfigError("Missing required option: source for [target:{name}]".format(name=name)) + raise ConfigError("Missing required option: source for [target/{name}]".format(name=name)) # global defaults _rsync_options = dict(options.rsync_options)