mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-02-02 04:39:07 +01:00
This commit is contained in:
@@ -30,8 +30,8 @@ class ServiceManager:
|
||||
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 @@ class ServiceManager:
|
||||
if items.find('slave') > -1:
|
||||
continue
|
||||
|
||||
if items.find('master') > -1:
|
||||
continue
|
||||
|
||||
counter = counter + 1
|
||||
|
||||
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
writeToFile = open(tempPath, 'w')
|
||||
|
||||
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 @@ class ServiceManager:
|
||||
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 @@ superslave=yes
|
||||
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 @@
|
||||
|
||||
<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 .serviceManager import ServiceManager
|
||||
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.")
|
||||
|
||||
Reference in New Issue
Block a user