action: Let each action track a status and log it.
[matthijs/projects/backupninja.git] / src / lib / backupninja / action.py
index 83afc954c8d782403d113b9e5dc3daa3eac65fb9..7707f3b5548a4772ee992ee0bfef1be2c894de36 100644 (file)
@@ -68,7 +68,15 @@ def run_action(action_config, opts, global_config):
         # Run it
         action.run(test=opts.test)
         action.finish(test=opts.test)
+        # Ask the action if there where any failures
+        success = not action.failed
     except Exception, e:
-        log.error('Running action "%s.%s" failed: %s', action_name, action_ty, e)
+        log.error('Unexpected exception: %s', e)
         import traceback
         log.debug(traceback.format_exc())
+        success = False
+
+    if success:
+        log.info('Running action "%s.%s" succeeded', action_name, action_ty)
+    else:
+        log.info('Running action "%s.%s" failed', action_name, action_ty)