This commit is contained in:
brent s. 2020-05-18 05:41:00 -04:00
parent 0868b18de8
commit bc12a6ad84
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
1 changed files with 7 additions and 14 deletions

View File

@ -16,23 +16,16 @@ class RA(object):


class RAConf(object):
def_tpl_name = None
def_conf = 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):
for k in ('name', 'dir'):
n = 'tpl_{0}'.format(k)
d = 'def_tpl_{0}'.format(k)
v = locals()[n]
if not v:
setattr(self, n, getattr(self, d))
else:
if v:
setattr(self, n, v)
if not conf:
self.conf = self.def_conf
else:
if conf:
self.conf = os.path.abspath(os.path.expanduser(conf))

def ext_init(self):
@ -140,8 +133,8 @@ class RASvc(object):

class RADVD(RA):
name = 'radvd'
def_conf = '/etc/radvd.conf'
def_tpl_name = 'radvd.conf.j2'
conf = '/etc/radvd.conf'
tpl_name = 'radvd.conf.j2'

def __init__(self, conf = None, tpl_name = None, tpl_dir = None):
super().__init__(conf = conf, tpl_name = tpl_name, tpl_dir = tpl_dir)
@ -150,8 +143,8 @@ class RADVD(RA):

class DNSMasq(RA):
name = 'dnsmasq'
def_conf = '/etc/dnsmasq.d/ra.conf'
def_tpl_name = 'dnsmasq.include.j2'
conf = '/etc/dnsmasq.d/ra.conf'
tpl_name = 'dnsmasq.include.j2'

def __init__(self, conf = None, tpl_name = None, tpl_dir = None):
super().__init__(conf = conf, tpl_name = tpl_name, tpl_dir = tpl_dir)