Actually some real stuff

This commit is contained in:
rperper
2018-10-26 16:25:13 -04:00
parent c2b09182c2
commit cb379b9281
3 changed files with 61 additions and 35 deletions

View File

@@ -6,20 +6,25 @@ import argparse
import os
import shlex
import socket
from install import preFlightsChecks
import install
#distros
centos=0
ubuntu=1
distro = install.get_distro()
class unInstallCyberPanel:
def unInstallCyberPanelRepo(self):
try:
copyPath = "/etc/yum.repos.d/cyberpanel.repo"
os.remove(copyPath)
if distro == centos:
try:
copyPath = "/etc/yum.repos.d/cyberpanel.repo"
os.remove(copyPath)
except OSError,msg:
logging.InstallLog.writeToFile(str(msg)+ " [unInstallCyberPanelRepo]")
except OSError,msg:
logging.InstallLog.writeToFile(str(msg)+ " [unInstallCyberPanelRepo]")
def removeGunicorn(self):
try:
@@ -41,7 +46,10 @@ class unInstallCyberPanel:
def removePostfixDovecot(self):
try:
command = 'yum -y remove postfix'
if distro == centos:
command = 'yum -y remove postfix'
else:
command = 'apt-get -y remove postfix'
cmd = shlex.split(command)
@@ -63,7 +71,10 @@ class unInstallCyberPanel:
def removeMysql(self):
try:
command = 'yum -y remove mariadb mariadb-server'
if distro == centos:
command = 'yum -y remove mariadb mariadb-server'
else:
command = 'apt-get -y remove mariadb-server'
cmd = shlex.split(command)
@@ -85,13 +96,16 @@ class unInstallCyberPanel:
def removeLiteSpeed(self):
try:
command = 'yum -y remove openlitespeed'
if distro == centos:
command = 'yum -y remove openlitespeed'
else:
command = 'apt-get -y remove openlitespeed'
cmd = shlex.split(command)
cmd = shlex.split(command)
res = subprocess.call(cmd)
res = subprocess.call(cmd)
shutil.rmtree("/usr/local/lsws")
shutil.rmtree("/usr/local/lsws")
except OSError, msg:
logging.InstallLog.writeToFile(str(msg) + " [removeLiteSpeed]")
@@ -119,13 +133,16 @@ class unInstallCyberPanel:
def removePureFTPD(self):
try:
command = 'yum -y remove pure-ftpd'
if distro == centos:
command = 'yum -y remove pure-ftpd'
else:
command = 'apt-get -y remove pure-ftpd'
cmd = shlex.split(command)
cmd = shlex.split(command)
res = subprocess.call(cmd)
res = subprocess.call(cmd)
shutil.rmtree("/etc/pure-ftpd")
shutil.rmtree("/etc/pure-ftpd")
except OSError, msg:
logging.InstallLog.writeToFile(str(msg) + " [removePureFTPD]")
@@ -137,14 +154,16 @@ class unInstallCyberPanel:
def removePowerDNS(self):
try:
if distro == centos:
command = 'yum -y remove pdns'
else:
command = 'apt-get -y remove pdns-server'
command = 'yum -y remove pdns'
cmd = shlex.split(command)
cmd = shlex.split(command)
res = subprocess.call(cmd)
res = subprocess.call(cmd)
shutil.rmtree("/etc/pdns")
shutil.rmtree("/etc/pdns")
except OSError, msg:
logging.InstallLog.writeToFile(str(msg) + " [removePowerDNS]")
@@ -157,13 +176,16 @@ class unInstallCyberPanel:
def removePHP(self):
try:
command = 'yum -y remove lsphp*'
if distro == centos:
command = 'yum -y remove lsphp*'
else:
command = 'apt-get -y remove lsphp*'
cmd = shlex.split(command)
cmd = shlex.split(command)
res = subprocess.call(cmd)
res = subprocess.call(cmd)
shutil.rmtree("/etc/pdns")
shutil.rmtree("/etc/pdns")
except OSError, msg:
logging.InstallLog.writeToFile(str(msg) + " [removePHP]")