Upraveno. Portál už nečte ani neinterpretuje READY/NOT READY z textu výstupu a nepřidává žádnou logiku pro disk, backup, Gitea ani Registry.
Změny: migration_readiness.py (line 140) teď určuje READY pouze jako returncode == 0; chybějící nebo nenulový return code je NOT READY. Preflight UI v routes/migration_readiness.py (line 85) zobrazuje Return code, summary OK/WARN/FAIL a oddělené raw stdout / stderr. Odstraněná vlastní logika, která hledala READY/NOT READY ve výstupu skriptu.
This commit is contained in:
@@ -137,32 +137,6 @@ def _first_int(data: dict[str, Any], keys: tuple[str, ...]) -> int | None:
|
||||
return None
|
||||
|
||||
|
||||
def _readiness_from_script_output(result_data: dict[str, Any], combined_text: str) -> bool:
|
||||
ready_value = result_data.get("ready")
|
||||
if isinstance(ready_value, bool):
|
||||
return ready_value
|
||||
|
||||
readiness_value = str(
|
||||
result_data.get("readiness")
|
||||
or result_data.get("migration_readiness")
|
||||
or result_data.get("migrationReadiness")
|
||||
or ""
|
||||
).strip().upper()
|
||||
|
||||
if readiness_value == "READY":
|
||||
return True
|
||||
if readiness_value == "NOT READY":
|
||||
return False
|
||||
|
||||
upper_text = combined_text.upper()
|
||||
if re.search(r"(?<![A-Z0-9_])NOT\s+READY(?![A-Z0-9_])", upper_text):
|
||||
return False
|
||||
if re.search(r"(?<![A-Z0-9_])READY(?![A-Z0-9_])", upper_text):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def summarize_readiness(job: dict[str, Any] | None) -> dict[str, Any]:
|
||||
if not job:
|
||||
return {
|
||||
@@ -170,18 +144,34 @@ def summarize_readiness(job: dict[str, Any] | None) -> dict[str, Any]:
|
||||
"ok_count": 0,
|
||||
"warn_count": 0,
|
||||
"fail_count": 0,
|
||||
"raw_output": "",
|
||||
"return_code": None,
|
||||
"stdout": "",
|
||||
"stderr": "",
|
||||
"job": None,
|
||||
}
|
||||
|
||||
raw_output = get_job_log_output(int(job["id"]))
|
||||
result_data = _result_data(job)
|
||||
return_code = _result_value(job, ("returncode", "return_code", "exit_code", "exitCode"))
|
||||
stdout = _result_value(job, ("stdout", "out"))
|
||||
stderr = _result_value(job, ("stderr", "err"))
|
||||
|
||||
if stdout is None:
|
||||
stdout = get_job_log_output(int(job["id"]), stream="stdout", include_stream=False)
|
||||
if stderr is None:
|
||||
stderr = get_job_log_output(int(job["id"]), stream="stderr", include_stream=False)
|
||||
|
||||
error_text = job.get("error_text") or ""
|
||||
if error_text:
|
||||
stderr = f"{stderr}\n{error_text}" if stderr else error_text
|
||||
|
||||
stdout = _redact_sensitive_text(str(stdout or ""))
|
||||
stderr = _redact_sensitive_text(str(stderr or ""))
|
||||
combined_text = "\n".join(
|
||||
value
|
||||
for value in (
|
||||
raw_output,
|
||||
stdout,
|
||||
stderr,
|
||||
job.get("result_json") or "",
|
||||
job.get("error_text") or "",
|
||||
)
|
||||
if value
|
||||
)
|
||||
@@ -198,11 +188,13 @@ def summarize_readiness(job: dict[str, Any] | None) -> dict[str, Any]:
|
||||
fail_count = _count_token(combined_text, "FAIL")
|
||||
|
||||
return {
|
||||
"ready": _readiness_from_script_output(result_data, combined_text),
|
||||
"ready": return_code == 0,
|
||||
"ok_count": ok_count,
|
||||
"warn_count": warn_count,
|
||||
"fail_count": fail_count,
|
||||
"raw_output": raw_output,
|
||||
"return_code": return_code,
|
||||
"stdout": stdout,
|
||||
"stderr": stderr,
|
||||
"job": job,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user