From 2013e66105bab2c141095023e9eaf345aded89f3 Mon Sep 17 00:00:00 2001 From: Justin Drew <2396364+jdrew82@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:01:58 -0500 Subject: [PATCH] Move exc_info to extra --- nornir_nautobot/plugins/tasks/dispatcher/default.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nornir_nautobot/plugins/tasks/dispatcher/default.py b/nornir_nautobot/plugins/tasks/dispatcher/default.py index 60da803..ca2d3bf 100644 --- a/nornir_nautobot/plugins/tasks/dispatcher/default.py +++ b/nornir_nautobot/plugins/tasks/dispatcher/default.py @@ -174,7 +174,7 @@ def generate_config( except NornirSubTaskError as exc: if isinstance(exc.result.exception, jinja2.exceptions.UndefinedError): # pylint: disable=no-else-raise error_msg = f"`E1010:` There was a jinja2.exceptions.UndefinedError error: ``{str(exc.result.exception)}``" - logger.error(error_msg, extra={"object": obj}, exc_info=True) + logger.error(error_msg, extra={"object": obj, "exc_info": True}) # raise NornirNautobotException(error_msg) raise exc.result.exception @@ -182,19 +182,19 @@ def generate_config( error_msg = ( f"`E1011:` There was a jinja2.TemplateSyntaxError error: ``{str(exc.result.exception)}``", ) - logger.error(error_msg, extra={"object": obj}, exc_info=True) + logger.error(error_msg, extra={"object": obj}) # raise NornirNautobotException(error_msg) raise exc.result.exception elif isinstance(exc.result.exception, jinja2.TemplateNotFound): error_msg = f"`E1012:` There was an issue finding the template and a jinja2.TemplateNotFound error was raised: ``{str(exc.result.exception)}``" - logger.error(error_msg, extra={"object": obj}, exc_info=True) + logger.error(error_msg, extra={"object": obj}) # raise NornirNautobotException(error_msg) raise exc.result.exception elif isinstance(exc.result.exception, jinja2.TemplateError): error_msg = f"`E1013:` There was an issue general Jinja error: ``{str(exc.result.exception)}``" - logger.error(error_msg, extra={"object": obj}, exc_info=True) + logger.error(error_msg, extra={"object": obj}) # raise NornirNautobotException(error_msg) raise exc.result.exception