main: Add --test option for a dry run.
authorMatthijs Kooijman <matthijs@stdin.nl>
Thu, 10 Jun 2010 12:23:20 +0000 (14:23 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Thu, 10 Jun 2010 12:23:20 +0000 (14:23 +0200)
src/backupninja
src/lib/backupninja/action.py

index 1c2d71c26cdce22620c60ed7c3494cec0d14c7bc..019dfbdb48cd0489afb793a672d232b75bba1dd0 100755 (executable)
@@ -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):
index e110d933d2aa521cbc7b334f3ad2bb072c28758f..3939c8d487e677968efae783cff753a3dec810ea 100644 (file)
@@ -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)