]> git.llucax.com Git - software/pymin.git/blobdiff - services/vpn/handler.py
Rearrange Host attributes from vpn service (closes #33)
[software/pymin.git] / services / vpn / handler.py
index ebfa0ab433663dea3edc87b4a9194c11738b178f..0bcf84f4b732672e247f48e1fd72f24f549b19a4 100644 (file)
@@ -6,36 +6,15 @@ import signal
 from os import path
 import logging ; log = logging.getLogger('pymin.services.vpn')
 
 from os import path
 import logging ; log = logging.getLogger('pymin.services.vpn')
 
-
 from pymin.seqtools import Sequence
 from pymin.seqtools import Sequence
-from pymin.dispatcher import Handler, handler, HandlerError
+from pymin.dispatcher import handler
 from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \
 from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \
-                               TransactionalHandler, DictSubHandler, DictComposedSubHandler, call, ExecutionError
-
-__all__ = ('VpnHandler', 'get_service')
-
-
-def get_service(config):
-    return VpnHandler(config.vpn.pickle_dir, config.vpn.config_dir)
-
-
-class Host(Sequence):
-    def __init__(self, vpn_src, ip, vpn_src_net, key):
-        self.name = vpn_src
-        self.ip = ip
-        self.src_net = vpn_src_net
-        self.pub_key = key
-        self._delete = False
-
-    def as_tuple(self):
-        return(self.name, self.ip, self.src_net, self.pub_key)
+                               TransactionalHandler, DictSubHandler, \
+                               call, ExecutionError
 
 
-class HostHandler(DictComposedSubHandler):
+from host import HostHandler
 
 
-    handler_help = u"Manage hosts for a vpn"
-    _comp_subhandler_cont = 'vpns'
-    _comp_subhandler_attr = 'hosts'
-    _comp_subhandler_class = Host
+__all__ = ('VpnHandler',)
 
 
 class Vpn(Sequence):
 
 
 class Vpn(Sequence):