]> git.llucax.com Git - software/pymin.git/commitdiff
Split vpn handler in submodules (refs #2).
authorLeandro Lucarella <llucax@gmail.com>
Fri, 20 Jun 2008 04:09:41 +0000 (01:09 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Fri, 20 Jun 2008 04:12:26 +0000 (01:12 -0300)
services/vpn/handler.py
services/vpn/host.py [new file with mode: 0644]

index 802e089393ac6f9eb3c31e8760292baafeecc478..0bcf84f4b732672e247f48e1fd72f24f549b19a4 100644 (file)
@@ -7,30 +7,14 @@ from os import path
 import logging ; log = logging.getLogger('pymin.services.vpn')
 
 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, \
-                               TransactionalHandler, DictSubHandler, DictComposedSubHandler, call, ExecutionError
+                               TransactionalHandler, DictSubHandler, \
+                               call, ExecutionError
 
-__all__ = ('VpnHandler')
+from host import HostHandler
 
-
-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)
-
-class HostHandler(DictComposedSubHandler):
-
-    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):
diff --git a/services/vpn/host.py b/services/vpn/host.py
new file mode 100644 (file)
index 0000000..d22de66
--- /dev/null
@@ -0,0 +1,26 @@
+# vim: set encoding=utf-8 et sw=4 sts=4 :
+
+from pymin.seqtools import Sequence
+from pymin.service.util import DictComposedSubHandler
+
+__all__ = ('HostHandler',)
+
+
+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)
+
+class HostHandler(DictComposedSubHandler):
+
+    handler_help = u"Manage hosts for a vpn"
+    _comp_subhandler_cont = 'vpns'
+    _comp_subhandler_attr = 'hosts'
+    _comp_subhandler_class = Host
+