Files
es24n-conf/modules/workflow_serial.py
scott c587e64f9e Fix JSON parsing in _serial_redfish_request when terminal wraps long curl commands
The serial terminal echoes the curl command back before executing it.
The -w format string contains '%{http_code}' which includes a literal '{'.
When the terminal wraps long command lines (IOM2's path is ~70 chars),
that '{' can land at a line boundary, causing find("{") to pick up the
wrong position and produce garbled JSON/error output.

Fix: narrow the JSON search to the text before the HTTP_CODE: marker,
then use rfind("\n{") to find the last newline-prefixed '{'. The actual
curl response always starts on its own line, while the echoed '{http_code}'
is embedded mid-line in the command echo — so rfind("\n{") reliably skips it.

Also tighten the error snippet to use the same search_area bounds so the
displayed error shows actual response content rather than command echo text.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 10:31:00 -04:00

24 KiB