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