X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fbackupninja.git;a=blobdiff_plain;f=src%2Flib%2Fbackupninja%2Faction.py;h=66fc5f364830f5b5221db05e44eab691a6115534;hp=95c43fd9d940760f0ea990e6dacb6bdb07a6444e;hb=75bf976607685eddaaab1d5239408b8f545ce158;hpb=b28c821a628aa44d082d167c4527d7776af5699e diff --git a/src/lib/backupninja/action.py b/src/lib/backupninja/action.py index 95c43fd..66fc5f3 100644 --- a/src/lib/backupninja/action.py +++ b/src/lib/backupninja/action.py @@ -33,7 +33,13 @@ def run_all_actions(opts, global_config): opts are the parsed commandline options, global_config is the parsed global configuration. """ - actions = config.list_actions(opts) + try: + actions = config.list_actions(opts) + except OSError, e: + log.critical('Unable to list actions: %s', e) + return + + actions.sort() for action in actions: run_action(action, opts, global_config) @@ -52,15 +58,12 @@ def run_action(action, opts, global_config): # Get the config for this action action_config = config.get_action_config(opts, action) - # Create a handler for this action - handler = handlers.create_handler(action_ty, action_config) - # Silently skip invalid handlers, create_handler will have - # logged an error - if handler: - try: - # Run the handler - handler.run() - handler.finish() - except Exception, e: - log.error('Running action "%s" failed: %s', action, e) + try: + # Create a handler for this action + handler = handlers.create_handler(action_ty, action_config) + # Run it + handler.run() + handler.finish() + except Exception, e: + log.error('Running action "%s" failed: %s', action, e)