Skip to content
Permalink
Browse files
bug fix: delete linux user upon website deletion
  • Loading branch information
usmannasir committed Mar 5, 2020
1 parent c9e11fd commit e6a817b9924e16a63238b59637eba6c3922f8133
Showing 1 changed file with 10 additions and 1 deletion.
@@ -349,6 +349,7 @@ def deleteVirtualHostConfigurations(virtualHostName):
vhost.deleteCoreConf(virtualHostName, numberOfSites)

delWebsite = Websites.objects.get(domain=virtualHostName)
externalApp = delWebsite.externalApp

##

@@ -376,8 +377,16 @@ def deleteVirtualHostConfigurations(virtualHostName):

## 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 %s' % (externalApp)
else:
command = 'deluser %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

0 comments on commit e6a817b

Please sign in to comment.