Compare commits
No commits in common. "5674bf339cd0d988e9ac53f739dffba07c07e2e4" and "d39078a78d837ebba3c62617805543414d8f7a80" have entirely different histories.
5674bf339c
...
d39078a78d
14
daemon.py
14
daemon.py
@ -163,7 +163,7 @@ def updateNsData(zone):
|
|||||||
|
|
||||||
hasToDelete = True
|
hasToDelete = True
|
||||||
|
|
||||||
adaptFileForRequire(zone, HOSTS_PATH, dumpFile)
|
adaptFileForRequire(zone, dumpFile)
|
||||||
if dnscontrolPush(zone) != 0:
|
if dnscontrolPush(zone) != 0:
|
||||||
raise Exception("Pushing data failed!")
|
raise Exception("Pushing data failed!")
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ def updateNsData(zone):
|
|||||||
log.warning(f'{adaptedZone} |\tUpdating NS-Data failed!')
|
log.warning(f'{adaptedZone} |\tUpdating NS-Data failed!')
|
||||||
|
|
||||||
if(hasToDelete):
|
if(hasToDelete):
|
||||||
deleteFile(os.path.join(HOSTS_PATH, dumpFile))
|
deleteFile(dumpFile)
|
||||||
|
|
||||||
def adaptZoneName(zone):
|
def adaptZoneName(zone):
|
||||||
if config['zone']['public-suffix'] != "" and zone.endswith(config['zone']['public-suffix']):
|
if config['zone']['public-suffix'] != "" and zone.endswith(config['zone']['public-suffix']):
|
||||||
@ -190,19 +190,17 @@ def deleteFile(file):
|
|||||||
os.remove(file)
|
os.remove(file)
|
||||||
|
|
||||||
ignoreLinesRexp = r"^\s*(var|D\(|DnsProvider\(|DefaultTTL\()"
|
ignoreLinesRexp = r"^\s*(var|D\(|DnsProvider\(|DefaultTTL\()"
|
||||||
def adaptFileForRequire(zone, path, dumpFile):
|
def adaptFileForRequire(zone, dumpFile):
|
||||||
log.debug(f"{zone} |\tRewriting file '{dumpFile}'..")
|
log.debug(f"{zone} |\tRewriting file '{dumpFile}'..")
|
||||||
|
|
||||||
dumpFilePath = os.path.join(path, dumpFile)
|
with open(dumpFile, 'r') as fin:
|
||||||
|
with open(f"{dumpFile}.tmp", 'w+') as fout:
|
||||||
with open(dumpFilePath, 'r') as fin:
|
|
||||||
with open(f"{dumpFilePath}.tmp", 'w+') as fout:
|
|
||||||
fout.write(f'D_EXTEND("{zone}",\n')
|
fout.write(f'D_EXTEND("{zone}",\n')
|
||||||
|
|
||||||
for line in fin:
|
for line in fin:
|
||||||
if not re.match(ignoreLinesRexp, line):
|
if not re.match(ignoreLinesRexp, line):
|
||||||
fout.write(line)
|
fout.write(line)
|
||||||
os.replace(f"{dumpFilePath}.tmp", dumpFilePath)
|
os.replace(f"{dumpFile}.tmp", dumpFile)
|
||||||
|
|
||||||
def dnscontrolPush(zone):
|
def dnscontrolPush(zone):
|
||||||
log.debug(f'{zone} |\tPushing..')
|
log.debug(f'{zone} |\tPushing..')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user