projects
/
matthijs
/
projects
/
backupninja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
config: Check action config filenames more strictly.
[matthijs/projects/backupninja.git]
/
src
/
lib
/
backupninja
/
action.py
diff --git
a/src/lib/backupninja/action.py
b/src/lib/backupninja/action.py
index 1ebc737cfdd76c7b0c176f175659128fd87e7a32..7c80148d9c24f15f86e1c49892449e81c62d7e2b 100644
(file)
--- 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.
"""
opts are the parsed commandline options, global_config is the parsed
global configuration.
"""
- actions = config.list_actions(opts)
+ log.info('Running all actions')
+ try:
+ actions = config.list_actions(opts)
+ except OSError, e:
+ log.critical('Unable to list actions: %s', e)
+ return
+
actions.sort()
for action in actions:
actions.sort()
for action in actions:
@@
-44,10
+50,11
@@
def run_action(action, opts, global_config):
Run a single action. opts are the parsed commandline options,
global_config is the parsed global configuration.
"""
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
# Split the action filename
- parts = action.split('.'
, 2
)
- if (len(parts)
<
2):
- log.error('Invalid action filename: "%s". Should be in the form name.type, where type is a valid handler.')
+ parts = action.split('.')
+ if (len(parts)
!=
2):
+ log.error('Invalid action filename: "%s". Should be in the form name.type, where type is a valid handler.'
% action
)
return
(action_name, action_ty) = parts
return
(action_name, action_ty) = parts
@@
-58,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
# 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)
except Exception, e:
log.error('Running action "%s" failed: %s', action, e)