1
0
mirror of https://github.com/oskar456/dzonegit.git synced 2024-05-11 05:55:41 +00:00

Do not template line breaks when header and footer are missing

This commit is contained in:
Ondřej Caletka
2018-09-17 13:48:52 +02:00
parent ef059861b7
commit 4efef8be9e
2 changed files with 6 additions and 2 deletions

View File

@ -358,7 +358,8 @@ def template_config(checkoutpath, template, blacklist=set(), whitelist=set()):
out = list()
zones = dict()
mapping = {"datetime": datetime.datetime.now().strftime("%c")}
out.append(headertpl.substitute(mapping))
if headertpl.template:
out.append(headertpl.substitute(mapping))
for f in sorted(Path(checkoutpath).glob("**/*.zone")):
zonename = get_zone_name(f, f.read_bytes())
if whitelist and not any(
@ -396,7 +397,8 @@ def template_config(checkoutpath, template, blacklist=set(), whitelist=set()):
mapping, zonename=zonename,
zonefile=str(f), zonevar=zonevar,
))
out.append(footertpl.substitute(mapping))
if footertpl.template:
out.append(footertpl.substitute(mapping))
return "\n".join(out)