add support for multiple addresses in zone.list

This commit is contained in:
Gilles Grandou 2019-10-08 10:05:17 +02:00
parent 95a20f78e5
commit bdcf586a6c
1 changed files with 6 additions and 2 deletions

View File

@ -103,7 +103,8 @@ def read_zone_list_from_file(zone_filename):
config.read(zone_filename)
for host in config:
for p in config[host]:
zone_list.append([host, p.upper(), config[host][p]])
for target in config[host][p].split('\n'):
zone_list.append([host, p.upper(), target])
return zone_list
@ -124,7 +125,10 @@ def write_zone_list_to_file(zone_filename, zone_list):
for host,typefield,target in zone_list:
if not host in config:
config[host] = {}
config[host][typefield] = target
if typefield in config[host]:
config[host][typefield] += '\n'+target
else:
config[host][typefield] = target
with open(zone_filename, 'w') as configfile:
config.write(configfile)