mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
push install status
This commit is contained in:
@@ -2625,3 +2625,16 @@ class CloudManager:
|
|||||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
def SubmitCyberPanelUpgrade(self):
|
||||||
|
try:
|
||||||
|
|
||||||
|
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/CyberPanelUpgrade.py"
|
||||||
|
ProcessUtilities.popenExecutioner(execPath)
|
||||||
|
final_json = json.dumps({'status': 1})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||||
|
final_json = json.dumps(final_dic)
|
||||||
|
return HttpResponse(final_json)
|
||||||
@@ -61,6 +61,8 @@ def router(request):
|
|||||||
return cm.getCurrentCloudBackups()
|
return cm.getCurrentCloudBackups()
|
||||||
elif controller == 'fetchCloudBackupSettings':
|
elif controller == 'fetchCloudBackupSettings':
|
||||||
return cm.fetchCloudBackupSettings()
|
return cm.fetchCloudBackupSettings()
|
||||||
|
elif controller == 'SubmitCyberPanelUpgrade':
|
||||||
|
return cm.SubmitCyberPanelUpgrade()
|
||||||
elif controller == 'saveCloudBackupSettings':
|
elif controller == 'saveCloudBackupSettings':
|
||||||
return cm.saveCloudBackupSettings()
|
return cm.saveCloudBackupSettings()
|
||||||
elif controller == 'deleteCloudBackup':
|
elif controller == 'deleteCloudBackup':
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ echo -e "\n${1}=${2}\n" >> /tmp/cyberpanel_debug.log
|
|||||||
|
|
||||||
Debug_Log2() {
|
Debug_Log2() {
|
||||||
echo -e "\n${1}" >> /var/log/installLogs.txt
|
echo -e "\n${1}" >> /var/log/installLogs.txt
|
||||||
|
curl -d '{"ipAddress": "${Server_IP}", "InstallCyberPanelStatus": "${1}}"' -H "Content-Type: application/json" -X POST http://http://de-a.cyberhosting.org:8000/servers/RecvData
|
||||||
}
|
}
|
||||||
|
|
||||||
Branch_Check() {
|
Branch_Check() {
|
||||||
|
|||||||
46
plogical/CyberPanelUpgrade.py
Normal file
46
plogical/CyberPanelUpgrade.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
import argparse
|
||||||
|
import requests
|
||||||
|
|
||||||
|
sys.path.append('/usr/local/CyberCP')
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
|
|
||||||
|
class UpgradeCyberPanel:
|
||||||
|
|
||||||
|
def __init__(self, branch, mail, dns, ftp):
|
||||||
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
|
f = open(ipFile)
|
||||||
|
ipData = f.read()
|
||||||
|
self.ipAddress = ipData.split('\n', 1)[0]
|
||||||
|
|
||||||
|
def PostStatus(self, message):
|
||||||
|
finalData = json.dumps({'ipAddress': self.ipAddress, "UpgradeCyberPanelStatus": message})
|
||||||
|
url = "http://de-a.cyberhosting.org:8000/settings/RecvData"
|
||||||
|
resp = requests.post(url, data=finalData, verify=False)
|
||||||
|
print (resp.text)
|
||||||
|
|
||||||
|
def UpgardeNow(self):
|
||||||
|
self.PostStatus('Upgrade in route..,35')
|
||||||
|
import time
|
||||||
|
time.sleep(10)
|
||||||
|
self.PostStatus('Upgrade completed. [200]')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||||
|
parser.add_argument('--branch', help='Branch to install.')
|
||||||
|
parser.add_argument('--mail', help='Upgrade mail services.')
|
||||||
|
parser.add_argument('--dns', help='Upgrade dns services.')
|
||||||
|
parser.add_argument('--ftp', help='Upgrade ftp services.')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
uc = UpgradeCyberPanel(1,1,1,1)
|
||||||
|
uc.UpgardeNow()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -2542,8 +2542,6 @@ vmail
|
|||||||
|
|
||||||
Upgrade.stdOut("Upgrade Completed.")
|
Upgrade.stdOut("Upgrade Completed.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||||
parser.add_argument('branch', help='Install from branch name.')
|
parser.add_argument('branch', help='Install from branch name.')
|
||||||
|
|||||||
Reference in New Issue
Block a user