Fixed managePDNS: select pdns.conf path according to OS; removed unnecessary /32; Move temp file to pdns.conf

This commit is contained in:
Mode
2021-03-14 07:35:12 +00:00
parent 79f1fe469b
commit ab835ae92e

View File

@@ -22,7 +22,11 @@ class ServiceManager:
def managePDNS(self):
type = self.extraArgs['type']
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
path = '/etc/pdns/pdns.conf'
else:
path = '/etc/powerdns/pdns.conf'
data = ProcessUtilities.outputExecutioner('sudo cat ' + path).splitlines()
#data = subprocess.check_output(shlex.split('sudo cat ' + path)).decode("utf-8").splitlines()
@@ -35,6 +39,7 @@ class ServiceManager:
ipStringNoSubnet = ''
for items in SlaveServers.objects.all():
if items.slaveServerIP:
ipsString = ipsString + '%s/32, ' % (items.slaveServerIP)
ipStringNoSubnet = ipStringNoSubnet + '%s, ' % (items.slaveServerIP)
@@ -74,6 +79,9 @@ class ServiceManager:
writeToFile.writelines('disable-axfr=no\n')
writeToFile.writelines('master=yes\n')
writeToFile.close()
command = 'sudo mv ' + tempPath + ' ' + path
ProcessUtilities.executioner(command)
else:
import os
@@ -317,4 +325,3 @@ def main():
if __name__ == "__main__":
main()