main: Add --test option for a dry run.
[matthijs/projects/backupninja.git] / src / lib / backupninja / action.py
index 66fc5f364830f5b5221db05e44eab691a6115534..3939c8d487e677968efae783cff753a3dec810ea 100644 (file)
@@ -33,6 +33,7 @@ def run_all_actions(opts, global_config):
     opts are the parsed commandline options, global_config is the parsed
     global configuration.
     """
+    log.info('Running all actions')
     try:
         actions = config.list_actions(opts)
     except OSError, e:
@@ -49,6 +50,7 @@ def run_action(action, opts, global_config):
     Run a single action. opts are the parsed commandline options,
     global_config is the parsed global configuration.
     """
+    log.info('Running action "%s"', action)
     # Split the action filename
     parts = action.split('.', 2)
     if (len(parts) < 2):
@@ -63,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)