From 8cb22cc702bdd2d9853311f0e6864fa6b2dd1885 Mon Sep 17 00:00:00 2001 From: Justin Cinkelj Date: Tue, 26 Sep 2023 09:16:10 +0200 Subject: [PATCH] Fix debug logging If exception occurred (timeout to HyperCore cluster), resp was not defined and code crashed. Also, q() cannot be called with kwargs syntax (`exception=ex`). Signed-off-by: Justin Cinkelj --- plugins/module_utils/client.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/module_utils/client.py b/plugins/module_utils/client.py index fe9f14ae..740e2d94 100644 --- a/plugins/module_utils/client.py +++ b/plugins/module_utils/client.py @@ -173,14 +173,9 @@ def _request( ) q_log(request_in, request_out) return resp - except Exception as ex: + except Exception as exception: if SC_DEBUG_LOG_TRAFFIC: - request_out = dict( - status=resp.status, - data=resp.data, - headers=resp.headers, - ) - q_log(request_in, exception=ex) + q_log(request_in, exception) raise def _request_no_log(