From f529f8fcd2fb7cbe8fcf8c7ee54706e807fc6556 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 4 Nov 2024 14:25:42 -0500 Subject: [PATCH] Fix JSON decoding error --- bootstrap-daemon/pvcbootstrapd/lib/redfish.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bootstrap-daemon/pvcbootstrapd/lib/redfish.py b/bootstrap-daemon/pvcbootstrapd/lib/redfish.py index 83793f3..116bacc 100755 --- a/bootstrap-daemon/pvcbootstrapd/lib/redfish.py +++ b/bootstrap-daemon/pvcbootstrapd/lib/redfish.py @@ -196,16 +196,17 @@ class RedfishSession: logger.debug(f"POST payload: {payload}") response = requests.post(url, data=payload, headers=self.headers, verify=False) + logger.debug(f"Response: {response.status_code}") if response.status_code in [200, 201, 204]: try: return response.json() - except json.decoder.JSONDecodeError as e: + except Exception: return {"json_err": e} else: try: rinfo = response.json()["error"]["@Message.ExtendedInfo"][0] - except json.decoder.JSONDecodeError: + except Exception: logger.debug(response) raise @@ -576,6 +577,7 @@ def set_power_state(session, system_root, redfish_vendor, state): """ Set the system power state to the desired state """ + logger.debug(f"Calling set_power_state with {session}, {system_root}, {redfish_vendor}, {state}") state_values = { "default": { "on": "On",