Skip to content

Commit

Permalink
Fix class interface parsing
Browse files Browse the repository at this point in the history
Otherwise INTERFACE attribute is left empty and populated with default settings later.
  • Loading branch information
anthonygego committed Jun 13, 2022
1 parent ba916f6 commit 70d57c5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions dhcpy6d/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def read_config(self, configfile):
error_exit(f"Interface '{interface}' used in section '[{section}]' "
f"of configuration file '{configfile}' is not "
"defined in general settings.")
self.CLASSES[section.lower().split('class_')[1]].INTERFACE.append(interface)
else:
self.CLASSES[section.lower().split('class_')[1]].__setattr__(item[0].upper(),
str(item[1]).strip())
Expand All @@ -472,7 +473,7 @@ def read_config(self, configfile):
if not 'default_' + interface in self.CLASSES:
self.CLASSES['default_' + interface] = copy.copy(self.CLASSES['default'])
self.CLASSES['default_' + interface].NAME = 'default_' + interface
self.CLASSES['default_' + interface].INTERFACE = interface
self.CLASSES['default_' + interface].INTERFACE = [interface]

# lower storage
self.STORE_CONFIG = self.STORE_CONFIG.lower()
Expand Down Expand Up @@ -542,9 +543,7 @@ def read_config(self, configfile):
c.NAMESERVER = listify_option(c.NAMESERVER)
if c.NTP_SERVER != '':
c.NTP_SERVER = listify_option(c.NTP_SERVER)
if c.INTERFACE != '':
c.INTERFACE = listify_option(c.INTERFACE)
else:
if len(c.INTERFACE) == 0:
# use general setting if none specified
c.INTERFACE = self.INTERFACE
# use default T1 and T2 if not defined
Expand Down Expand Up @@ -1193,7 +1192,7 @@ def __init__(self, name=''):
# REBIND time
self.T2 = 0
# at which interface this class of clients is served
self.INTERFACE = ''
self.INTERFACE = list()
# in certain cases it might be useful not to give any address to clients, for example if only a defined group
# of hosts should get IPv6 addresses and others not. They will get a 'NoAddrsAvail' handler if this option
# is set to 'noaddress' or no answer at all if set to 'none'
Expand Down

0 comments on commit 70d57c5

Please sign in to comment.