]> git.llucax.com Git - software/pymin.git/blob - services/vpn/host.py
Import HandlerError in vpn service handler (closes #32)
[software/pymin.git] / services / vpn / host.py
1 # vim: set encoding=utf-8 et sw=4 sts=4 :
2
3 from pymin.seqtools import Sequence
4 from pymin.service.util import DictComposedSubHandler
5
6 __all__ = ('HostHandler',)
7
8
9 class Host(Sequence):
10     def __init__(self, name, address, subnet, public_key):
11         self.name = name
12         self.address = address
13         self.subnet = subnet
14         self.public_key = public_key
15         self._delete = False
16
17     def as_tuple(self):
18         return(self.name, self.address, self.subnet, self.public_key)
19
20 class HostHandler(DictComposedSubHandler):
21
22     handler_help = u"Manage hosts for a vpn"
23     _comp_subhandler_cont = 'vpns'
24     _comp_subhandler_attr = 'hosts'
25     _comp_subhandler_class = Host
26