Fix _serial_redfish_request: use rfind for HTTP_CODE: boundary

The curl -w argument in the command echo contains the literal text
'HTTP_CODE:%{http_code}', so raw.find("HTTP_CODE:") hits that first
and cuts search_area off before the actual JSON response body — leaving
data as {}.  Switching to rfind targets the real HTTP_CODE:200 output
that curl appends at the end of the response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 11:21:17 -04:00
parent 2d27e9760a
commit f08550dbea

View File

@@ -180,7 +180,10 @@ def _serial_redfish_request(ser: SerialPort, password: str, method: str,
# curl response body appears there), then find the LAST newline-prefixed
# '{' — because the JSON response always starts on its own line, while
# the echoed '{http_code}' is embedded mid-line in the curl command echo.
http_code_pos = raw.find("HTTP_CODE:")
# Use rfind (not find) — the -w argument in the echoed curl command also
# contains the literal text "HTTP_CODE:", so find() would land there instead
# of at the actual HTTP_CODE:200 output that curl appends at the end.
http_code_pos = raw.rfind("HTTP_CODE:")
search_area = raw[:http_code_pos].rstrip() if http_code_pos >= 0 else raw
data: dict = {}