X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fbackupninja.git;a=blobdiff_plain;f=src%2Flib%2Fbackupninja%2Faction.py;h=7707f3b5548a4772ee992ee0bfef1be2c894de36;hp=b4245f4c236b6a2961ecc6dc8932dd96f4956712;hb=db3987f515ca9f9e9d9437f7a7454e050e1ec273;hpb=d64d30066c2cbcf02e1c4d05198ca430584b5cbd diff --git a/src/lib/backupninja/action.py b/src/lib/backupninja/action.py index b4245f4..7707f3b 100644 --- a/src/lib/backupninja/action.py +++ b/src/lib/backupninja/action.py @@ -62,13 +62,21 @@ def run_action(action_config, opts, global_config): try: # Create a handler for this action - handler = handlers.create_handler(action_ty) + action = handlers.create_action(action_ty) # Let the handler load its configuration file - handler.load_config(action_config) + action.load_config(action_config) # Run it - handler.run(test=opts.test) - handler.finish(test=opts.test) + 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)