bug fix: imuinfy restore after upgrade
This commit is contained in:
parent
f13a1b8c20
commit
195dac046f
|
|
@ -4283,27 +4283,46 @@ pm.max_spare_servers = 3
|
||||||
command = f'chmod +x {executePath}'
|
command = f'chmod +x {executePath}'
|
||||||
Upgrade.executioner(command, command, 1)
|
Upgrade.executioner(command, command, 1)
|
||||||
|
|
||||||
# Handle main Imunify execute permissions - using community-proven solution
|
# Handle main Imunify execute permissions - comprehensive solution for missing files
|
||||||
if os.path.exists(imunifyPath):
|
if os.path.exists(imunifyPath):
|
||||||
# Use the exact solution from CyberPanel community (https://community.cyberpanel.net/t/imunifyav-permission-denied-after-upgrade/34159/4)
|
# First, check if the bin directory and execute.py file exist
|
||||||
# Change to the imunify directory and set execute permissions
|
binDir = '/usr/local/CyberCP/public/imunify/bin'
|
||||||
command = f'cd {imunifyPath} && chmod +x ./bin/execute.py 2>/dev/null || true'
|
executeFile = '/usr/local/CyberCP/public/imunify/bin/execute.py'
|
||||||
if Upgrade.executioner(command, 'Setting execute permissions on Imunify360 execute.py using community solution', 0):
|
|
||||||
Upgrade.stdOut("Imunify360 execute permissions set successfully using community method")
|
if not os.path.exists(binDir):
|
||||||
restored = True
|
Upgrade.stdOut(f"Warning: Imunify360 bin directory missing at {binDir}")
|
||||||
|
# Try to find if execute.py exists elsewhere
|
||||||
|
command = f'find {imunifyPath} -name "execute.py" -type f 2>/dev/null'
|
||||||
|
result = subprocess.getstatusoutput(command)
|
||||||
|
if result[0] == 0 and result[1].strip():
|
||||||
|
Upgrade.stdOut(f"Found execute.py files: {result[1]}")
|
||||||
|
# Set permissions on all found execute.py files
|
||||||
|
command = f'find {imunifyPath} -name "execute.py" -type f -exec chmod +x {{}} \\; 2>/dev/null || true'
|
||||||
|
Upgrade.executioner(command, 'Setting execute permissions on found execute.py files', 0)
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("No execute.py files found in Imunify360 directory - installation may be incomplete")
|
||||||
else:
|
else:
|
||||||
Upgrade.stdOut("Warning: Community method failed, trying alternative approach")
|
# Bin directory exists, try the community solution
|
||||||
|
command = f'cd {imunifyPath} && chmod +x ./bin/execute.py 2>/dev/null || true'
|
||||||
# Alternative: use absolute path
|
if Upgrade.executioner(command, 'Setting execute permissions on Imunify360 execute.py using community solution', 0):
|
||||||
specificPath = '/usr/local/CyberCP/public/imunify/bin/execute.py'
|
Upgrade.stdOut("Imunify360 execute permissions set successfully using community method")
|
||||||
if os.path.exists(specificPath):
|
|
||||||
command = f'chmod +x {specificPath}'
|
|
||||||
Upgrade.executioner(command, f'Setting execute permissions using absolute path: {specificPath}', 0)
|
|
||||||
restored = True
|
restored = True
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut("Warning: Community method failed, trying alternative approach")
|
||||||
|
|
||||||
# Also set permissions on any other execute.py files found
|
# Alternative: use absolute path if file exists
|
||||||
command = f'find {imunifyPath} -name "execute.py" -type f -exec chmod +x {{}} \\; 2>/dev/null || true'
|
if os.path.exists(executeFile):
|
||||||
Upgrade.executioner(command, 'Setting execute permissions on all execute.py files', 0)
|
command = f'chmod +x {executeFile}'
|
||||||
|
Upgrade.executioner(command, f'Setting execute permissions using absolute path: {executeFile}', 0)
|
||||||
|
restored = True
|
||||||
|
else:
|
||||||
|
Upgrade.stdOut(f"execute.py file not found at {executeFile}")
|
||||||
|
|
||||||
|
# Also set permissions on any other execute.py files found
|
||||||
|
command = f'find {imunifyPath} -name "execute.py" -type f -exec chmod +x {{}} \\; 2>/dev/null || true'
|
||||||
|
Upgrade.executioner(command, 'Setting execute permissions on all execute.py files', 0)
|
||||||
|
|
||||||
|
restored = True # Mark as restored even if files are missing, to indicate we processed it
|
||||||
|
|
||||||
if restored:
|
if restored:
|
||||||
Upgrade.stdOut("Imunify360 restoration completed successfully")
|
Upgrade.stdOut("Imunify360 restoration completed successfully")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue