mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
fix: NameError in wsrelay when JSON decode fails with DEBUG logging (#16340)
* fix: NameError in wsrelay when JSON decode fails with DEBUG logging run_connection() referenced payload in the JSONDecodeError handler, but payload was never assigned because json.loads() is what failed. Use msg.data instead to log the raw message content. Fixes: AAP-68045 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix other instance of undefined payload --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: AlanCoding <arominge@redhat.com>
This commit is contained in:
@@ -139,7 +139,7 @@ class WebsocketRelayConnection:
|
||||
except json.JSONDecodeError:
|
||||
logmsg = "Failed to decode message from web node"
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
logmsg = "{} {}".format(logmsg, payload)
|
||||
logmsg = "{} {}".format(logmsg, msg.data)
|
||||
logger.warning(logmsg)
|
||||
continue
|
||||
|
||||
@@ -242,7 +242,7 @@ class WebSocketRelayManager(object):
|
||||
except json.JSONDecodeError:
|
||||
logmsg = "Failed to decode message from pg_notify channel `web_ws_heartbeat`"
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
logmsg = "{} {}".format(logmsg, payload)
|
||||
logmsg = "{} {}".format(logmsg, notif.payload)
|
||||
logger.warning(logmsg)
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user