proxmox: tolerate NUL-padded agent output and avoid false stage guards
powershell.exe over the guest agent can return UTF-16LE, so Test-Path read as T\0r\0u\0e and every 'grep true' failed. Strip NULs in _qga_unwrap, and only treat an explicit False as proof that the role script is absent.
This commit is contained in:
@@ -286,9 +286,11 @@ try:
|
|||||||
except Exception:
|
except Exception:
|
||||||
print("could not parse guest agent output", file=sys.stderr)
|
print("could not parse guest agent output", file=sys.stderr)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
sys.stdout.write(data.get("out", ""))
|
out = data.get("out", "").replace("\x00", "")
|
||||||
if data.get("err", "").strip():
|
err = data.get("err", "").replace("\x00", "")
|
||||||
sys.stderr.write(data["err"])
|
sys.stdout.write(out)
|
||||||
|
if err.strip():
|
||||||
|
sys.stderr.write(err)
|
||||||
sys.exit(int(data.get("exitcode", 0)))
|
sys.exit(int(data.get("exitcode", 0)))
|
||||||
PY
|
PY
|
||||||
}
|
}
|
||||||
@@ -320,8 +322,10 @@ backend_start() {
|
|||||||
local name=$1 remote=$2
|
local name=$1 remote=$2
|
||||||
|
|
||||||
# Fail in seconds, not after the one-hour marker wait, when the seed
|
# Fail in seconds, not after the one-hour marker wait, when the seed
|
||||||
# payload never reached the guest.
|
# payload never reached the guest. Only an explicit False is conclusive.
|
||||||
if ! backend_ps "$name" "Test-Path '${remote}'" 2>/dev/null | grep -qi true; then
|
local exists
|
||||||
|
exists=$(backend_ps "$name" "Test-Path '${remote}'" 2>/dev/null | tr -d '[:space:]')
|
||||||
|
if [[ $exists == False ]]; then
|
||||||
fail "$name: ${remote} is missing — the seed payload was not copied"
|
fail "$name: ${remote} is missing — the seed payload was not copied"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user