Skip to content
Permalink
Browse files
bug fix: #346
  • Loading branch information
usmannasir committed May 22, 2020
1 parent d71b304 commit ca1d507ac242439afbe4e3930477860bd02abf49
Showing 3 changed files with 42 additions and 19 deletions.
@@ -30,8 +30,8 @@ def managePDNS(self):
ipsString = ipsString.rstrip(' ')
ipStringNoSubnet = ipStringNoSubnet.rstrip(' ')



tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
writeToFile = open(tempPath, 'w')

for items in data:
if items.find('allow-axfr-ips') > -1:
@@ -49,14 +49,14 @@ def managePDNS(self):
if items.find('slave') > -1:
continue

counter = counter + 1
if items.find('master') > -1:
continue

tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
writeToFile = open(tempPath, 'w')
counter = counter + 1

for items in data:
writeToFile.writelines(items + '\n')


writeToFile.writelines('allow-axfr-ips=' + ipsString + '\n')
writeToFile.writelines('also-notify=' + ipStringNoSubnet + '\n')
writeToFile.writelines('daemon=no\n')
@@ -82,6 +82,9 @@ def managePDNS(self):
if items.find('slave') > -1:
continue

if items.find('slave=yes') > 1:
return 0

counter = counter + 1

tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
@@ -112,6 +115,5 @@ def managePDNS(self):
Supermasters(ip=self.extraArgs['masterServerIP'], nameserver=self.extraArgs['slaveServerNS'], account='').save()

command = 'sudo mv ' + tempPath + ' ' + path
#subprocess.call(shlex.split(command))
ProcessUtilities.executioner(command)

@@ -51,57 +51,57 @@ <h3 class="content-box-header">

<div ng-hide="masterServerHD" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave Server" %}</label>
<div class="col-sm-6">
<div ng-init="slaveServerNS='{{ slaveServerNS }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveServerNS" required>
</div>
</div>

<div ng-hide="masterServerHD" class="form-group">
<label class="col-sm-3 control-label">{% trans "Master Server IP" %}</label>
<div class="col-sm-6">
<div ng-init="masterServerIP='{{ masterServerIP }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="masterServerIP" required>
</div>
</div>

<div ng-hide="slaveIPs" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave Server 1" %}</label>
<div class="col-sm-6">
<div ng-init="slaveServer='{{ slaveServer }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveServer" required>
</div>
</div>

<div ng-hide="slaveIPs" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave Server IP" %}</label>
<div class="col-sm-6">
<div ng-init="slaveServerIP='{{ slaveServerIP }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveServerIP" required>
</div>
</div>

<div ng-hide="slaveIPs" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave Server 2 (Optional)" %}</label>
<div class="col-sm-6">
<div ng-init="slaveServer2='{{ slaveServer2 }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveServer2" required>
</div>
</div>

<div ng-hide="slaveIPs" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave Server IP 2 (Optional)" %}</label>
<div class="col-sm-6">
<div ng-init="slaveServerIP2='{{ slaveServerIP2 }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveServerIP2" required>
</div>
</div>

<div ng-hide="slaveIPs" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave Server 3 (Optional)" %}</label>
<div class="col-sm-6">
<div ng-init="slaveServer3='{{ slaveServer3 }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveServer3" required>
</div>
</div>

<div ng-hide="slaveIPs" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave Server IP 3 (Optional)" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveIPData" required>
<div ng-init="slaveServerIP3='{{ slaveServerIP3 }}'" class="col-sm-6">
<input type="text" class="form-control" ng-model="slaveServerIP3" required>
</div>
</div>

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-


from django.shortcuts import render
from django.shortcuts import HttpResponse, redirect
import plogical.CyberCPLogFileWriter as logging
@@ -14,19 +13,41 @@
from plogical.processUtilities import ProcessUtilities
# Create your views here.


def managePowerDNS(request):
try:
userID = request.session['userID']
currentACL = ACLManager.loadedACL(userID)


if currentACL['admin'] == 1:
pass
else:
return ACLManager.loadError()
try:
return render(request, 'manageServices/managePowerDNS.html', {"status": 1})

data = {}
data['status'] = 1

pdnsStatus = PDNSStatus.objects.get(pk=1)

if pdnsStatus.type == 'MASTER':
counter = 1

for items in SlaveServers.objects.all():

if counter == 1:
data['slaveServer'] = items.slaveServer
data['slaveServerIP'] = items.slaveServerIP
else:
data['slaveServer%s' % (str(counter))] = items.slaveServer
data['slaveServerIP%s' % (str(counter))] = items.slaveServerIP

counter = counter + 1
else:
data['slaveServerNS'] = pdnsStatus.masterServer
data['masterServerIP'] = pdnsStatus.masterIP

return render(request, 'manageServices/managePowerDNS.html', data)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return HttpResponse("See CyberCP main log file.")

0 comments on commit ca1d507

Please sign in to comment.