hrm
This commit is contained in:
parent
0868b18de8
commit
bc12a6ad84
@ -16,23 +16,16 @@ class RA(object):
|
|||||||
|
|
||||||
|
|
||||||
class RAConf(object):
|
class RAConf(object):
|
||||||
def_tpl_name = None
|
|
||||||
def_conf = None
|
|
||||||
cfgstr = None
|
cfgstr = None
|
||||||
def_tpl_dir = os.path.join(os.path.dirname(os.path.abspath(os.path.expanduser(__file__))), 'tpl')
|
tpl_dir = os.path.join(os.path.dirname(os.path.abspath(os.path.expanduser(__file__))), 'tpl')
|
||||||
|
|
||||||
def __init__(self, conf = None, tpl_name = None, tpl_dir = None, *args, **kwargs):
|
def __init__(self, conf = None, tpl_name = None, tpl_dir = None, *args, **kwargs):
|
||||||
for k in ('name', 'dir'):
|
for k in ('name', 'dir'):
|
||||||
n = 'tpl_{0}'.format(k)
|
n = 'tpl_{0}'.format(k)
|
||||||
d = 'def_tpl_{0}'.format(k)
|
|
||||||
v = locals()[n]
|
v = locals()[n]
|
||||||
if not v:
|
if v:
|
||||||
setattr(self, n, getattr(self, d))
|
|
||||||
else:
|
|
||||||
setattr(self, n, v)
|
setattr(self, n, v)
|
||||||
if not conf:
|
if conf:
|
||||||
self.conf = self.def_conf
|
|
||||||
else:
|
|
||||||
self.conf = os.path.abspath(os.path.expanduser(conf))
|
self.conf = os.path.abspath(os.path.expanduser(conf))
|
||||||
|
|
||||||
def ext_init(self):
|
def ext_init(self):
|
||||||
@ -140,8 +133,8 @@ class RASvc(object):
|
|||||||
|
|
||||||
class RADVD(RA):
|
class RADVD(RA):
|
||||||
name = 'radvd'
|
name = 'radvd'
|
||||||
def_conf = '/etc/radvd.conf'
|
conf = '/etc/radvd.conf'
|
||||||
def_tpl_name = 'radvd.conf.j2'
|
tpl_name = 'radvd.conf.j2'
|
||||||
|
|
||||||
def __init__(self, conf = None, tpl_name = None, tpl_dir = None):
|
def __init__(self, conf = None, tpl_name = None, tpl_dir = None):
|
||||||
super().__init__(conf = conf, tpl_name = tpl_name, tpl_dir = tpl_dir)
|
super().__init__(conf = conf, tpl_name = tpl_name, tpl_dir = tpl_dir)
|
||||||
@ -150,8 +143,8 @@ class RADVD(RA):
|
|||||||
|
|
||||||
class DNSMasq(RA):
|
class DNSMasq(RA):
|
||||||
name = 'dnsmasq'
|
name = 'dnsmasq'
|
||||||
def_conf = '/etc/dnsmasq.d/ra.conf'
|
conf = '/etc/dnsmasq.d/ra.conf'
|
||||||
def_tpl_name = 'dnsmasq.include.j2'
|
tpl_name = 'dnsmasq.include.j2'
|
||||||
|
|
||||||
def __init__(self, conf = None, tpl_name = None, tpl_dir = None):
|
def __init__(self, conf = None, tpl_name = None, tpl_dir = None):
|
||||||
super().__init__(conf = conf, tpl_name = tpl_name, tpl_dir = tpl_dir)
|
super().__init__(conf = conf, tpl_name = tpl_name, tpl_dir = tpl_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user