--- a/scripts/pvlbackup-rsync-snapshot Thu Feb 16 10:53:13 2012 +0200
+++ b/scripts/pvlbackup-rsync-snapshot Thu Feb 16 11:17:46 2012 +0200
@@ -146,15 +146,17 @@
# subsections
section_path = section_name.split(':')
- # lookup dict
+ # lookup section dict from config
lookup = config
+ # XXX: sections are not in order, so we can't rely on the parent section being created before we handle the sub-section
for name in section_path :
+ # possibly create
if name not in lookup :
lookup[name] = {}
-
+
lookup = lookup[name]
-
+
# found dict for this section
config_section = lookup
@@ -377,7 +379,7 @@
if os.path.exists(temp_path) :
raise Exception("Old temp snapshot dir remains, please clean up: {path}".format(path=temp_path))
- log.info("Perform main snapshot: %s", snapshot_path)
+ log.info("Perform main snapshot: %s -> %s", self.source, snapshot_path)
# build rsync options
opts = dict(self.rsync_options)
@@ -639,7 +641,11 @@
if options.config :
# load
- config = parse_config(options.config, config)
+ try :
+ config = parse_config(options.config, config)
+ except ConfigError as e:
+ log.error("Configuration error: %s: %s", options.config, e)
+ return 2
# manual?
if options.target :
@@ -672,9 +678,19 @@
# store
options.rsync_options[option] = value
- # all targets?
+ # what targets?
if not targets :
+ # default to all defined targets
targets = list(config['targets'])
+
+ else :
+ # given ones, but verify they exist
+ for target in targets :
+ if target not in config['targets'] :
+ log.error("Unknown target given: %s", target)
+ log.info("Defined targets: %s", ' '.join(config['targets']))
+
+ return 2
# targets
for name in targets :
@@ -688,6 +704,9 @@
# run
target.run(options)
+ # ok
+ return 0
+
def config_defaults () :
return dict(
# snapshots/ naming
--- a/setup.py Thu Feb 16 10:53:13 2012 +0200
+++ b/setup.py Thu Feb 16 11:17:46 2012 +0200
@@ -3,7 +3,7 @@
setup(
name = 'pvl.backup',
- version = '0.2',
+ version = '0.2.1',
url = 'http://hg.qmsk.net/pvl-backup/',
author = 'Tero Marttila',