Closed jdrew82 closed 5 months ago
I am not sure what to do, this contract with upstream is expecting there to be a NornirNautobotException
raised, so there are implications. In my humble opinion, this is where this should be handled https://github.com/nautobot/nautobot/issues/2331, otherwise it is a game of whack-a-mole in which we will never win.
From our discussion I attempted to just log the traceback and unfortunately the closest you can get is the Traceback object itself but that doesn't appear to contain the full traceback, just the start of it and we need the end. We can ignore this request and consider it a not gonna work.
Looks like @jmpettit figured out how to get the traceback logged in #149!
When working with the generate_config function the current behavior has any Exceptions from Jinja2 being masked by raising a NornirNautobotException with log message. This means that any logging that is done in a Job is unable to see the full traceback. If we instead re-raised the same Exception we'd have access to the traceback and could log it. The traceback is essential with config generation as it allows quick identification of where the error lies. For example:
The full traceback is this:
but the Job logs only show
E1010: There was a jinja2.exceptions.UndefinedError error: 'site' is undefined
. You have to look at the STDERR logs to find the traceback. It'd be much more useful if we could log the traceback as that's where the important information is.