mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-04 12:17:29 +02:00
Resolve /usr/local/CyberPanel/bin/python on install, upgrade, downgrade
Install: - install.py: in preFlightsChecks.call(), replace missing CyberPanel python with /usr/bin/python3 and force shell=True so any code path (including old/cached script) never hits FileNotFoundError. Upgrade: - cyberpanel_upgrade.sh: resolve CP_PYTHON (CyberPanel, CyberCP, python3) before running upgrade.py and configure.py; use it for both. - plogical/upgrade.py: add _python_for_manage(), use it in GeneralMigrations, collectstatic, and upgradePip so migrations/collectstatic work when /usr/local/CyberPanel/bin/python is missing.
This commit is contained in:
@@ -2839,6 +2839,13 @@ module cyberpanel_ols {
|
||||
# Using shared function from install_utils
|
||||
@staticmethod
|
||||
def call(command, distro, bracket, message, log=0, do_exit=0, code=os.EX_OK, shell=False):
|
||||
# Fix missing /usr/local/CyberPanel/bin/python on install/upgrade (avoid FileNotFoundError)
|
||||
if isinstance(command, str) and '/usr/local/CyberPanel/bin/python' in command:
|
||||
if not os.path.isfile('/usr/local/CyberPanel/bin/python'):
|
||||
fallback = '/usr/bin/python3' if os.path.isfile('/usr/bin/python3') else '/usr/local/bin/python3'
|
||||
if os.path.isfile(fallback):
|
||||
command = command.replace('/usr/local/CyberPanel/bin/python', fallback, 1)
|
||||
shell = True
|
||||
return install_utils.call(command, distro, bracket, message, log, do_exit, code, shell)
|
||||
|
||||
def checkIfSeLinuxDisabled(self):
|
||||
|
||||
Reference in New Issue
Block a user