diff --git a/utils/he_ipv6/ra.py b/utils/he_ipv6/ra.py index b139d0e..2b5591e 100644 --- a/utils/he_ipv6/ra.py +++ b/utils/he_ipv6/ra.py @@ -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)