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:
|
||||
print("could not parse guest agent output", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
sys.stdout.write(data.get("out", ""))
|
||||
if data.get("err", "").strip():
|
||||
sys.stderr.write(data["err"])
|
||||
out = data.get("out", "").replace("\x00", "")
|
||||
err = data.get("err", "").replace("\x00", "")
|
||||
sys.stdout.write(out)
|
||||
if err.strip():
|
||||
sys.stderr.write(err)
|
||||
sys.exit(int(data.get("exitcode", 0)))
|
||||
PY
|
||||
}
|
||||
@@ -320,8 +322,10 @@ backend_start() {
|
||||
local name=$1 remote=$2
|
||||
|
||||
# Fail in seconds, not after the one-hour marker wait, when the seed
|
||||
# payload never reached the guest.
|
||||
if ! backend_ps "$name" "Test-Path '${remote}'" 2>/dev/null | grep -qi true; then
|
||||
# payload never reached the guest. Only an explicit False is conclusive.
|
||||
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"
|
||||
return 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user