mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-11 15:56:11 +01:00
add further error checking during upgrade
This commit is contained in:
@@ -53,6 +53,9 @@ class UpgradeCyberPanel:
|
|||||||
command = 'cp -R /usr/local/CyberCP /usr/local/CyberCPBak'
|
command = 'cp -R /usr/local/CyberCP /usr/local/CyberCPBak'
|
||||||
Upgrade.executioner(command, command)
|
Upgrade.executioner(command, command)
|
||||||
|
|
||||||
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
self.PostStatus('Failed to execute %s. [404]' % (command))
|
||||||
|
|
||||||
self.PostStatus('Upgrading/Downgrading to branch %s..,10' % (self.branch))
|
self.PostStatus('Upgrading/Downgrading to branch %s..,10' % (self.branch))
|
||||||
|
|
||||||
status, message = Upgrade.downloadAndUpgrade(None, self.branch)
|
status, message = Upgrade.downloadAndUpgrade(None, self.branch)
|
||||||
@@ -80,7 +83,6 @@ class UpgradeCyberPanel:
|
|||||||
|
|
||||||
self.PostStatus('Database updated.,55')
|
self.PostStatus('Database updated.,55')
|
||||||
|
|
||||||
|
|
||||||
## Put function here to update custom ACLs
|
## Put function here to update custom ACLs
|
||||||
|
|
||||||
Upgrade.UpdateConfigOfCustomACL()
|
Upgrade.UpdateConfigOfCustomACL()
|
||||||
@@ -99,12 +101,14 @@ class UpgradeCyberPanel:
|
|||||||
Upgrade.upgradeVersion()
|
Upgrade.upgradeVersion()
|
||||||
Upgrade.UpdateMaxSSLCons()
|
Upgrade.UpdateMaxSSLCons()
|
||||||
|
|
||||||
|
command = 'systemctl restart lscpd'
|
||||||
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
self.PostStatus('Failed to execute %s. [404]' % (command))
|
||||||
|
|
||||||
self.PostStatus('CyberPanel Upgraded/Downgraded to %s. [200]' % (self.branch))
|
self.PostStatus('CyberPanel Upgraded/Downgraded to %s. [200]' % (self.branch))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||||
parser.add_argument('--branch', help='Branch to install.')
|
parser.add_argument('--branch', help='Branch to install.')
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class Upgrade:
|
|||||||
break
|
break
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def updateRepoURL():
|
def updateRepoURL():
|
||||||
@@ -1706,10 +1706,14 @@ imap_folder_list_limit = 0
|
|||||||
os.chdir('/usr/local/CyberCP')
|
os.chdir('/usr/local/CyberCP')
|
||||||
|
|
||||||
command = 'git config --global user.email "support@cyberpanel.net"'
|
command = 'git config --global user.email "support@cyberpanel.net"'
|
||||||
Upgrade.executioner(command, command, 1)
|
|
||||||
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
command = 'git config --global user.name "CyberPanel"'
|
command = 'git config --global user.name "CyberPanel"'
|
||||||
Upgrade.executioner(command, command, 1)
|
|
||||||
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
command = 'git status'
|
command = 'git status'
|
||||||
currentBranch = subprocess.check_output(shlex.split(command)).decode()
|
currentBranch = subprocess.check_output(shlex.split(command)).decode()
|
||||||
@@ -1718,17 +1722,20 @@ imap_folder_list_limit = 0
|
|||||||
'On branch %s-dev' % (branch)) == -1:
|
'On branch %s-dev' % (branch)) == -1:
|
||||||
|
|
||||||
command = 'git stash'
|
command = 'git stash'
|
||||||
Upgrade.executioner(command, command, 1)
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
command = 'git pull'
|
command = 'git pull'
|
||||||
Upgrade.executioner(command, command, 1)
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
elif currentBranch.find('not a git repository') > -1:
|
elif currentBranch.find('not a git repository') > -1:
|
||||||
|
|
||||||
os.chdir('/usr/local')
|
os.chdir('/usr/local')
|
||||||
|
|
||||||
command = 'git clone https://github.com/usmannasir/cyberpanel'
|
command = 'git clone https://github.com/usmannasir/cyberpanel'
|
||||||
Upgrade.executioner(command, 'Download CyberPanel', 1)
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
if os.path.exists('CyberCP'):
|
if os.path.exists('CyberCP'):
|
||||||
shutil.rmtree('CyberCP')
|
shutil.rmtree('CyberCP')
|
||||||
@@ -1738,16 +1745,20 @@ imap_folder_list_limit = 0
|
|||||||
else:
|
else:
|
||||||
|
|
||||||
command = 'git fetch'
|
command = 'git fetch'
|
||||||
Upgrade.executioner(command, command, 1)
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
command = 'git stash'
|
command = 'git stash'
|
||||||
Upgrade.executioner(command, command, 1)
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
command = 'git checkout %s' % (branch)
|
command = 'git checkout %s' % (branch)
|
||||||
Upgrade.executioner(command, command, 1)
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
command = 'git pull'
|
command = 'git pull'
|
||||||
Upgrade.executioner(command, command, 1)
|
if not Upgrade.executioner(command, command, 1):
|
||||||
|
return 0, 'Failed to execute %s' % (command)
|
||||||
|
|
||||||
## Copy settings file
|
## Copy settings file
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user