fix(reboot): accept windows verifier crlf markers
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m2s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 0s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 9s

This commit is contained in:
Your Name
2026-07-03 02:12:25 +08:00
parent 0dd6d72424
commit aa5eddbe33
2 changed files with 37 additions and 0 deletions

View File

@@ -265,6 +265,7 @@ else
DRY_RUN="false"
REMOTE_VERIFY_ATTEMPTED=1
if REMOTE_VERIFY_OUTPUT="$(run_ssh_timed "${SSH_AUTHENTICATED_USER}" "${REMOTE_VERIFY_TIMEOUT}" "${REMOTE_VERIFY_COMMAND}" <"${LOCAL_VERIFY_SCRIPT}" 2>&1)"; then
REMOTE_VERIFY_OUTPUT="${REMOTE_VERIFY_OUTPUT//$'\r'/}"
REMOTE_VERIFY_EXIT_STATUS=0
if grep -q '^AWOOOI_WINDOWS99_VMWARE_AUTOSTART=1$' <<<"${REMOTE_VERIFY_OUTPUT}" && grep -q '^MODE=Verify$' <<<"${REMOTE_VERIFY_OUTPUT}"; then
VERIFY_COLLECTION_STATUS="collected_windows99_vmware_verify_stdout"

View File

@@ -294,3 +294,39 @@ def test_collect_mode_rejects_success_exit_without_verify_marker(tmp_path: Path)
assert values["remote_verify_exit_status"] == "0"
assert values["verify_collection_status"] == "blocked_remote_verify_output_invalid"
assert "AWOOOI_WINDOWS99_VMWARE_AUTOSTART=1" not in result.stdout
def test_collect_mode_accepts_windows_crlf_verify_markers(tmp_path: Path) -> None:
fake_bin = tmp_path / "bin"
fake_bin.mkdir()
_write_executable(
fake_bin / "nc",
"""
#!/usr/bin/env bash
exit 0
""",
)
_write_executable(
fake_bin / "ssh",
"""
#!/usr/bin/env bash
args="$*"
if [[ "$args" == *"powershell"* ]]; then
printf 'AWOOOI_WINDOWS99_VMWARE_AUTOSTART=1\\r\\n'
printf 'MODE=Verify\\r\\n'
printf 'VMRUN_PRESENT=1\\r\\n'
printf 'VMWARE_AUTOSTART_VERIFY_READY=0\\r\\n'
exit 0
fi
printf '%s\n' 'AWOOOI_WINDOWS99_SSH_READY'
exit 0
""",
)
result = _run_collector(fake_bin, "--collect")
assert result.returncode == 0
values = _key_values(result.stdout)
assert values["verify_collection_status"] == "collected_windows99_vmware_verify_stdout"
assert "AWOOOI_WINDOWS99_VMWARE_AUTOSTART=1\r" not in result.stdout
assert "VMWARE_AUTOSTART_VERIFY_READY=0" in result.stdout