mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 15:26:13 +01:00
bug fix: website creation
This commit is contained in:
@@ -190,6 +190,8 @@ class ProcessUtilities(multi.Thread):
|
|||||||
sock = ret[0]
|
sock = ret[0]
|
||||||
|
|
||||||
if user == None:
|
if user == None:
|
||||||
|
if command.find('sudo') == -1:
|
||||||
|
command = 'sudo %s' % (command)
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
logging.writeToFile(ProcessUtilities.token + command)
|
logging.writeToFile(ProcessUtilities.token + command)
|
||||||
sock.sendall((ProcessUtilities.token + command).encode('utf-8'))
|
sock.sendall((ProcessUtilities.token + command).encode('utf-8'))
|
||||||
|
|||||||
@@ -49,16 +49,13 @@ class vhost:
|
|||||||
else:
|
else:
|
||||||
command = "adduser " + virtualHostUser + " -M -d " + path
|
command = "adduser " + virtualHostUser + " -M -d " + path
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
ProcessUtilities.executioner(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
|
||||||
|
|
||||||
command = "groupadd " + virtualHostUser
|
command = "groupadd " + virtualHostUser
|
||||||
cmd = shlex.split(command)
|
ProcessUtilities.executioner(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
|
||||||
|
|
||||||
command = "usermod -a -G " + virtualHostUser + " " + virtualHostUser
|
command = "usermod -a -G " + virtualHostUser + " " + virtualHostUser
|
||||||
cmd = shlex.split(command)
|
ProcessUtilities.executioner(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [addingUsers]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [addingUsers]")
|
||||||
@@ -135,6 +132,7 @@ class vhost:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
## For configuration files permissions will be changed later globally.
|
## For configuration files permissions will be changed later globally.
|
||||||
|
if not os.path.exists(confPath):
|
||||||
os.makedirs(confPath)
|
os.makedirs(confPath)
|
||||||
except OSError as msg:
|
except OSError as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
@@ -380,13 +378,22 @@ class vhost:
|
|||||||
command = "rm -rf /home/vmail/" + virtualHostName
|
command = "rm -rf /home/vmail/" + virtualHostName
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
command = 'userdel %s' % (externalApp)
|
command = 'userdel -r -f %s' % (externalApp)
|
||||||
else:
|
else:
|
||||||
command = 'deluser %s' % (externalApp)
|
command = 'deluser %s' % (externalApp)
|
||||||
|
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
command = 'groupdel %s' % (externalApp)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
||||||
return 0
|
return 0
|
||||||
@@ -398,6 +405,7 @@ class vhost:
|
|||||||
vhost.deleteCoreConf(virtualHostName, numberOfSites)
|
vhost.deleteCoreConf(virtualHostName, numberOfSites)
|
||||||
|
|
||||||
delWebsite = Websites.objects.get(domain=virtualHostName)
|
delWebsite = Websites.objects.get(domain=virtualHostName)
|
||||||
|
externalApp = delWebsite.externalApp
|
||||||
|
|
||||||
## Cagefs
|
## Cagefs
|
||||||
|
|
||||||
@@ -427,8 +435,22 @@ class vhost:
|
|||||||
|
|
||||||
## Delete mail accounts
|
## Delete mail accounts
|
||||||
|
|
||||||
command = "sudo rm -rf /home/vmail/" + virtualHostName
|
command = "rm -rf /home/vmail/" + virtualHostName
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
command = 'userdel -r -f %s' % (externalApp)
|
||||||
|
else:
|
||||||
|
command = 'deluser %s' % (externalApp)
|
||||||
|
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
command = 'groupdel %s' % (externalApp)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
||||||
|
|||||||
Reference in New Issue
Block a user