matthijs/projects/backupninja.git
14 years agohandlers: Make create_action pass any kwargs to the constructor.
Matthijs Kooijman [Sat, 7 Aug 2010 19:37:38 +0000 (21:37 +0200)]
handlers: Make create_action pass any kwargs to the constructor.

14 years agolog: Make the log_exception support a per instance logger.
Matthijs Kooijman [Sat, 7 Aug 2010 19:09:20 +0000 (21:09 +0200)]
log: Make the log_exception support a per instance logger.

Previously, the logger to use was always passed to the decorator
directly, thus it must be known at class-definition time. Now, the
decorator supports not being passed a logger, in which case it will
assume the decorated function is a method on an object that has a "log"
attribute.

14 years agoAction: store a logger object in each Action.
Matthijs Kooijman [Sat, 7 Aug 2010 18:53:20 +0000 (20:53 +0200)]
Action: store a logger object in each Action.

This will allow log messages to include the action they originate from
in the future.

14 years agohandlers: Add fail_on_exception handler.
Matthijs Kooijman [Sat, 7 Aug 2010 18:48:53 +0000 (20:48 +0200)]
handlers: Add fail_on_exception handler.

This decorator is meant for methods on Action subclasses and records
failure when the decorated method throws an exception.

14 years agolog: Add log_exception decorator.
Matthijs Kooijman [Sat, 7 Aug 2010 18:46:22 +0000 (20:46 +0200)]
log: Add log_exception decorator.

This decorator catches, logs and swallows exceptions thrown in the
decorated function.

14 years agoaction: Let each action track a status and log it.
Matthijs Kooijman [Sat, 7 Aug 2010 18:38:25 +0000 (20:38 +0200)]
action: Let each action track a status and log it.

This allows (in the future) for a nice summary after each run and allows
actions to fail without breaking out with an exception right away.

14 years agoAction: Add config accessor functions.
Matthijs Kooijman [Fri, 6 Aug 2010 16:24:14 +0000 (18:24 +0200)]
Action: Add config accessor functions.

These convenience functions allow for accessing configuration values
either allowing them to be unset (and return None) or mandatory (and
throw an appropriate exception). By default, ConfigParser throws an
exception with a less appropriate exception.

14 years agoconfig: Allow specifying configuration values with no default.
Matthijs Kooijman [Fri, 6 Aug 2010 16:22:46 +0000 (18:22 +0200)]
config: Allow specifying configuration values with no default.

By specifying a default of None, a config value will have no default. We
could just leave out the value alltogether, but this way even values
without a default are "documented" (this will be extended later).

14 years agohandlers: Rename Handler class to Action.
Matthijs Kooijman [Mon, 26 Jul 2010 17:18:41 +0000 (19:18 +0200)]
handlers: Rename Handler class to Action.

Since instances of this class are really actions, not handlers that can
handle multiple actions, the name Action seems more appropriate (note
that the class itself could be seen as a handler, just not its
instances).

14 years agoconfig: Restructure config loading to allow defaults.
Matthijs Kooijman [Mon, 26 Jul 2010 17:04:03 +0000 (19:04 +0200)]
config: Restructure config loading to allow defaults.

Handlers now load their own configuration files, so they can pass
default configuration values. This also allows for more complicated
configuration loading in handlers by overriding the load_config method.

14 years agoconfig: Remove unused variables.
Matthijs Kooijman [Mon, 26 Jul 2010 16:50:28 +0000 (18:50 +0200)]
config: Remove unused variables.

These variables got unused in commit:

b99a9b8 Add commandline options for configuration files.

14 years agoactions: Print a traceback on failed actions in debug mode.
Matthijs Kooijman [Thu, 10 Jun 2010 13:35:49 +0000 (15:35 +0200)]
actions: Print a traceback on failed actions in debug mode.

14 years agoconfig: Check action config filenames more strictly.
Matthijs Kooijman [Thu, 10 Jun 2010 13:13:44 +0000 (15:13 +0200)]
config: Check action config filenames more strictly.

Previously, the filename was split at the first dot, now it can only
contain just one dot. Also fix the error message to actually include the
faulty filename.

14 years agoconfig: Skip action configs starting with a dot.
Matthijs Kooijman [Thu, 10 Jun 2010 13:12:06 +0000 (15:12 +0200)]
config: Skip action configs starting with a dot.

This prevents hidden files (like vim swapfiles) from being treated as a
config file.

14 years agomain: Add --test option for a dry run.
Matthijs Kooijman [Thu, 10 Jun 2010 12:23:20 +0000 (14:23 +0200)]
main: Add --test option for a dry run.

14 years agohandlers: Add **kwargs to Handler methods.
Matthijs Kooijman [Thu, 10 Jun 2010 12:21:19 +0000 (14:21 +0200)]
handlers: Add **kwargs to Handler methods.

This allows for easy addition of extra parameters later on.

14 years agomisc: Add some extra info and debug statements.
Matthijs Kooijman [Thu, 10 Jun 2010 07:11:32 +0000 (09:11 +0200)]
misc: Add some extra info and debug statements.

14 years agomain: Add --debug option to increase verbosity.
Matthijs Kooijman [Thu, 10 Jun 2010 07:10:55 +0000 (09:10 +0200)]
main: Add --debug option to increase verbosity.

14 years agoAdd commandline options for configuration files.
Matthijs Kooijman [Thu, 10 Jun 2010 07:00:01 +0000 (09:00 +0200)]
Add commandline options for configuration files.

14 years agoactions: Handle OSErrors when listing action configs.
Matthijs Kooijman [Thu, 10 Jun 2010 06:54:42 +0000 (08:54 +0200)]
actions: Handle OSErrors when listing action configs.

14 years agoactions: Handle exceptions thrown by create_handler.
Matthijs Kooijman [Thu, 10 Jun 2010 06:28:38 +0000 (08:28 +0200)]
actions: Handle exceptions thrown by create_handler.

14 years agohandlers: Make create_handler throw exceptions on errors.
Matthijs Kooijman [Thu, 10 Jun 2010 06:28:26 +0000 (08:28 +0200)]
handlers: Make create_handler throw exceptions on errors.

14 years agoactions: Sort actions before running them.
Matthijs Kooijman [Thu, 10 Jun 2010 06:26:07 +0000 (08:26 +0200)]
actions: Sort actions before running them.

14 years agoactions: Catch and log exceptions when running handlers.
Matthijs Kooijman [Thu, 10 Jun 2010 06:18:29 +0000 (08:18 +0200)]
actions: Catch and log exceptions when running handlers.

14 years agotest: Log at INFO instead of ERROR.
Matthijs Kooijman [Thu, 10 Jun 2010 06:07:44 +0000 (08:07 +0200)]
test: Log at INFO instead of ERROR.

14 years agolog: Set default logging level to INFO.
Matthijs Kooijman [Thu, 10 Jun 2010 06:07:08 +0000 (08:07 +0200)]
log: Set default logging level to INFO.

14 years agohandlers: Add a .test handler.
Matthijs Kooijman [Mon, 17 May 2010 17:05:24 +0000 (19:05 +0200)]
handlers: Add a .test handler.

This is a very simple Hello, world handler, which simply logs a
configurable message.

14 years agomain: Make the backupninja script run all actions.
Matthijs Kooijman [Mon, 17 May 2010 17:04:42 +0000 (19:04 +0200)]
main: Make the backupninja script run all actions.

14 years agomain: Add action loading and running infrastructure.
Matthijs Kooijman [Mon, 17 May 2010 17:04:28 +0000 (19:04 +0200)]
main: Add action loading and running infrastructure.

14 years agomisc: Make git ignore .pyc files.
Matthijs Kooijman [Mon, 17 May 2010 17:01:36 +0000 (19:01 +0200)]
misc: Make git ignore .pyc files.

14 years agomain: Add backupninja.handlers package.
Matthijs Kooijman [Tue, 11 May 2010 19:18:13 +0000 (21:18 +0200)]
main: Add backupninja.handlers package.

14 years agomain: Add configuration infrastructure.
Matthijs Kooijman [Tue, 11 May 2010 19:06:56 +0000 (21:06 +0200)]
main: Add configuration infrastructure.

14 years agomain: Add logging infrastructure.
Matthijs Kooijman [Tue, 11 May 2010 19:06:16 +0000 (21:06 +0200)]
main: Add logging infrastructure.

14 years agomain: Add "backupninja" package.
Matthijs Kooijman [Tue, 11 May 2010 19:17:35 +0000 (21:17 +0200)]
main: Add "backupninja" package.

14 years agomain: Add (nearly empty) initial script.
Matthijs Kooijman [Wed, 5 May 2010 16:46:15 +0000 (18:46 +0200)]
main: Add (nearly empty) initial script.