mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-11 15:56:11 +01:00
allow ElasticRearch remove
This commit is contained in:
@@ -206,6 +206,51 @@ type=rpm-md
|
||||
"Packages successfully installed.[200]\n", 1)
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def RemoveElasticSearch():
|
||||
|
||||
statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')
|
||||
|
||||
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
|
||||
command = 'rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
repoPath = '/etc/yum.repos.d/elasticsearch.repo'
|
||||
|
||||
try:
|
||||
os.remove(repoPath)
|
||||
except:
|
||||
pass
|
||||
|
||||
command = 'yum erase elasticsearch -y'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
else:
|
||||
|
||||
try:
|
||||
os.remove('/etc/apt/sources.list.d/elastic-7.x.list')
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
command = 'apt-get remove elasticsearch -y'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
### Tmp folder configurations
|
||||
|
||||
command = 'rm -rf /home/elasticsearch/tmp'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
|
||||
jvmOptions = '/etc/elasticsearch/jvm.options'
|
||||
|
||||
|
||||
command = 'rm -f /home/cyberpanel/elasticsearch'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"ElasticSearch successfully removed.[200]\n", 1)
|
||||
return 0
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser(description='CyberPanel Application Manager')
|
||||
@@ -216,6 +261,8 @@ def main():
|
||||
|
||||
if args["function"] == "InstallElasticSearch":
|
||||
ServiceManager.InstallElasticSearch()
|
||||
elif args["function"] == "RemoveElasticSearch":
|
||||
ServiceManager.RemoveElasticSearch()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -351,6 +351,8 @@ def removeInstall(request):
|
||||
if appName == 'Elastic Search':
|
||||
if status == 'Installing':
|
||||
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/manageServices/serviceManager.py --function InstallElasticSearch'
|
||||
else:
|
||||
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/manageServices/serviceManager.py --function RemoveElasticSearch'
|
||||
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
data_ret = {'status': 1}
|
||||
|
||||
Reference in New Issue
Block a user