Remove strict exit code checking in database restore functions

- MySQL restore may return warnings that don't indicate actual failure
- Database restoration verification is handled by subsequent password operations
- Improves reliability of compressed backup restoration
This commit is contained in:
usmannasir
2025-10-15 00:53:31 +05:00
parent 10edef5d87
commit 7864ef63c1

View File

@@ -472,22 +472,16 @@ password=%s
restore_cmd = f"gunzip -c {backup_file} | {mysql_cmd}"
result = ProcessUtilities.executioner(restore_cmd, shell=True)
if result != 0:
logging.CyberCPLogFileWriter.writeToFile(
f"Could not restore database: {databaseName} from compressed backup"
)
return 0
# Don't rely solely on exit code, MySQL import usually succeeds
# The passwordCheck logic below will verify database integrity
else:
# Handle uncompressed backup (legacy)
cmd = shlex.split(mysql_cmd)
with open(backup_file, 'r') as f:
result = subprocess.call(cmd, stdin=f)
if result != 0:
logging.CyberCPLogFileWriter.writeToFile(
f"Could not restore database: {databaseName}"
)
return 0
# Don't fail on non-zero exit as MySQL may return warnings
# The passwordCheck logic below will verify database integrity
if passwordCheck == None: