]> git.llucax.com Git - software/pymin.git/blobdiff - pymin/services/dhcp/__init__.py
Fix ConfigWriter class documentation.
[software/pymin.git] / pymin / services / dhcp / __init__.py
index dd2fa9d0f2b4438f6a4b549dd6f616896614389a..b5bf6f3801ea46bd9ad0c79197921462a5f37c83 100644 (file)
@@ -1,25 +1,15 @@
 # vim: set encoding=utf-8 et sw=4 sts=4 :
 
 from os import path
+import logging ; log = logging.getLogger('pymin.services.dhcp')
 
 from pymin.seqtools import Sequence
 from pymin.dispatcher import Handler, handler, HandlerError
 from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \
                                 TransactionalHandler, ParametersHandler, \
-                                DictSubHandler
+                                DictSubHandler, ReloadHandler
 
-__ALL__ = ('DhcpHandler', 'Error')
-
-class Error(HandlerError):
-    r"""
-    Error(message) -> Error instance :: Base DhcpHandler exception class.
-
-    All exceptions raised by the DhcpHandler inherits from this one, so you can
-    easily catch any DhcpHandler exception.
-
-    message - A descriptive error message.
-    """
-    pass
+__all__ = ('DhcpHandler',)
 
 class Host(Sequence):
     r"""Host(name, ip, mac) -> Host instance :: Class representing a host.
@@ -54,11 +44,11 @@ class HostHandler(DictSubHandler):
 
     handler_help = u"Manage DHCP hosts"
 
-    _dict_subhandler_attr = 'hosts'
-    _dict_subhandler_class = Host
+    _cont_subhandler_attr = 'hosts'
+    _cont_subhandler_class = Host
 
-class DhcpHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler,
-                  ParametersHandler):
+class DhcpHandler(Restorable, ConfigWriter, ReloadHandler, TransactionalHandler,
+                  ParametersHandler, InitdHandler):
     r"""DhcpHandler([pickle_dir[, config_dir]]) -> DhcpHandler instance.
 
     Handles DHCP service commands for the dhcpd program.
@@ -95,10 +85,11 @@ class DhcpHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler,
 
     def __init__(self, pickle_dir='.', config_dir='.'):
         r"Initialize DhcpHandler object, see class documentation for details."
+        log.debug(u'DhcpHandler(%r, %r)', pickle_dir, config_dir)
         self._persistent_dir = pickle_dir
         self._config_writer_cfg_dir = config_dir
         self._config_build_templates()
-        self._restore()
+        InitdHandler.__init__(self)
         self.host = HostHandler(self)
 
     def _get_config_vars(self, config_file):
@@ -107,6 +98,12 @@ class DhcpHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler,
 
 if __name__ == '__main__':
 
+    logging.basicConfig(
+        level   = logging.DEBUG,
+        format  = '%(asctime)s %(levelname)-8s %(message)s',
+        datefmt = '%H:%M:%S',
+    )
+
     import os
 
     h = DhcpHandler()