Nicolas Emiliani [Mon, 26 Nov 2007 12:52:34 +0000 (09:52 -0300)]
Added support to hook services to IPHandler.
A service that has to be restarted after detection
of a device bring up, can be hooked to do so by calling
the method device_up_hook. The service while be added to
the hook list only in case it has the attributes start
and stop.
Nicolas Emiliani [Mon, 12 Nov 2007 13:42:29 +0000 (10:42 -0300)]
Hack for DNS timer_handle added.
The hack consists in redifinig de timer_handle because
the generic one that was used to check if the process was running
returned a pid that did not belong with the process wanted (named),
that was due to teh fact that named is in a path used to execute
an option of the syslog deamon.
Nicolas Emiliani [Thu, 25 Oct 2007 14:54:54 +0000 (11:54 -0300)]
Verificacion de interfaces usando handle_timer().
En util.py se corrige get_network_devices para que
levante los link/ppp.
En ip/__init__.py se agrega refresh_devices para que
a travez del handle_timer se puedan agregar los devices
que se registran a travez del commando ppp y tambien
se borren los devices caidos.
Add support for a simple timer to do periodic tasks.
Base support is on EventLoop, who handles the timer
life and calls handle_timer() when the timer is
expired. dispatcher.Handler has a simple default
handle_timer() implementation that just promote the
"handle_timer message" to all subhandlers, while
PyDaemon just start "spreading the voice" by calling
the root handler handle_timer() method.
Add support for service running status and restoring at startup.
Now ServiceHandler stores a persistent status of the service, to know if
the service should be started at startup (or reloaded when reload command
is called). To do that it inherits from Restorable, so restarting and
committing is now not done at _restore() any more. InetdHandler now
inherits from ServiceHandler to take advantage of its features.
ServiceHandler now support callables _service_{start,stop,restart,reload}
attributes to ease the customization.
PppHandler is a special case where each connection has it own running
status. All start, stop, restart and reload takes the name argument as
optional. If a name is not provided, all connections are processed. On
restart, all connections are (re)started, on reload (and at startup), only the previous
running connectinos are restarted.
ConfigWriter's _write_config() now can return True to indicate that commit
command shouldn't reload the service.
VrrpHandler now uses python's kill to stop the service.
Use more consistent getter name in ContainerSubHandler.
Now the method to access to the container attribute is named _attr() (and
_vattr) instead of _cont() (and _vcont). The method accept now an optional
'attr' argument to act as a setter.
Add support to "operation tagging" to ListSubHandler and DictSubHandler.
"Operation tagging" means that if the contained objects has an _add,
_update or _delete attribute, it set them to true when the item is
added, updated or deleted respectively (in case that it's deleted, it's
not removed from the container, but it's not listed either, i.e. the
items are "logically" deleted, not really removed from the container).
Now ListSubHandler and DictSubHandler ihnerit from a new class
ContainerSubHandler which handles 95% of the code. Because of this, now
the "magic" attributes starts with _cont_ instead of _list_ or _dict_.
Existing handler were updated, but new ones should take this into
account.
Add a new, backward compatible, way to specify specific config dirs.
Now _config_writer_cfg_dir could be a dictionary instead of a string.
The dictionary maps template filenames to directories where to generate
(render) the configure files.
Raise a CommandNotFoundError if updating an object without update().
When a DictSubHandler try to update an object that doesn't have an
update() method, it raises a CommandNotFoundError to emulate that the
update command doesn't exist.