From 79e2eb7919193ff6d6bf5c6452aa531497590bd5 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 10 Jun 2010 14:23:20 +0200 Subject: [PATCH] main: Add --test option for a dry run. --- src/backupninja | 7 +++++++ src/lib/backupninja/action.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backupninja b/src/backupninja index 1c2d71c..019dfbd 100755 --- a/src/backupninja +++ b/src/backupninja @@ -64,6 +64,13 @@ def make_option_parser(): "more verbose." , action="store_true" , dest="debug") + parser.add_option( "-t", "--test" + , help="Run in testing mode. This means no actions " + "are taken, only show what would be done " + "(as far as possible without taking " + "actions, of course)." + , action="store_true" + , dest="test") return parser def main(argv): diff --git a/src/lib/backupninja/action.py b/src/lib/backupninja/action.py index e110d93..3939c8d 100644 --- a/src/lib/backupninja/action.py +++ b/src/lib/backupninja/action.py @@ -65,7 +65,7 @@ def run_action(action, opts, global_config): # Create a handler for this action handler = handlers.create_handler(action_ty, action_config) # Run it - handler.run() - handler.finish() + handler.run(test=opts.test) + handler.finish(test=opts.test) except Exception, e: log.error('Running action "%s" failed: %s', action, e) -- 2.30.2