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.
Rollback did never worked right on composed handlers (handlers with
sub-handlers) because when the class attributes were unpickled, they were
bounded to a new object instance, and the sub-handlers references were
never updated (the sub-handler referenced directly the handler attributes).
Now all sub-handlers references the handler object itself (called parent)
so when the unpikle is done, all can reference to the same objects.
Use a handler object as the root dispatcher handler instead of a dict.
Now the dispatcher use a handler object as the root handler. This way you
can inherit your root handler from Handler and get the useful 'help' and
'coommands' commands for free.
A new module is created: services.util which has a lot of helper classes
and functions to do common tasks of service handlers. Actual classes are:
Persistent, Restorable, ConfigWriter, ServiceHandler, InitdHandler and
TransactionalHandler (see documentation for details).
A call() function is provided as a simple wrapper for subprocess.call() to
execute simple commands. It can raise and ExecutionError, as a wrapper for
subprocess.call exceptions or ReturnNot0Error if the returned value is not
0.
Se modifica para que haga el flush ante un commit
y ademas se parse la salida del ip link list para
cargar en el init los devices y direcciones mac de
cada device
Se modifica config.py para que levante un DnsHandler.
Se modifica pymindaemon para que en caso de error 0 agregue
un fin de linea.
Se heredan las excepciones de Dns del HandlerError
.Se corrije el _write_config para que se comporte segun lo
esperado.
Add support for quoted and keyword arguments to the Dispatcher.
Now it's possible to dispatch commands with quoted arguments, like:
echo "hello world"
Keyword arguments are supported too, you can write something like:
set variable=value
and the handler for set will be called like set(variable="value").
Add help messages and command listing to dispatcher handlers.
Now the @handle decorator takes a mandatory help argument to specify a
short help string for that handler. A new functions get_help() is added to
the dispatcher module to get the help string from a handler.
A new base Handler class is provided in dispatcher module to automatically
have a 'help' and 'commands' commands available.
Now all errors that should be reported back to the pymin client should
inherit from dispatcher.HandlerError. Any other error is reported to the
client as an internal server error and it's printed in the daemon standard
output for debugging purposes. A new line is now appended to errors
reported to the client for better consistency with OK responses.
Use the serializer mode to automatically serialize handlers results.
Handlers now don't have to worry about serialization. All they have to do
is return list of values (which can be lists or iterable object). Then the
PyminDaemon serialize them to UTF-8 encoded CSV strings and send them
through socket.
Add a decorator to mark which callables are exported by the dispatcher.
All callables which should handle a command should be maked with the
@handler decorator. This is for the sake of security, so users can't call
arbitrary python code (like a constructor).
The path where to store pickled configuration and generated config files
is configurable when constructing the instance.
If there's a pickled configuration it's automatically loaded at
construction time. If not, a new configuration based on defaults is dumped
to disk.
New methods are added: restart(), reload() and rollback() and DhcpHandler
is published in the services module and included in the pymin daemon
command tree.
This error is raised as a translation for the select.error, raised when
the system call is interrupted by a signal, so EventLoop users don't have
to know the details about the loop.
A complete example of a handler class. It uses mako for templates and (c)Pickle
for configuration persistence. There is some more work to be done (loading
pickled configuration and other details) but the class is pretty functional.