Sceptre/sceptre

Jinja Errors in Stack Configs do not show the Stack Name in the Error Message

X-Guardian opened this issue · 3 comments

Subject of the issue

If your Sceptre stack configs contain a Jinja error (referencing a non-existing Jinja variable is a typical scenario we have), then the error message on stack launch does not contain details of the stack config containing the error. This is particularly annoying when there is a large dependency tree on the stack that is being launched, and the Jinja error is deep within the tree.

Your environment

  • version of sceptre 3.2.0
  • version of python 3.8.8
  • which OS/distro: Windows 10

Steps to reproduce

dev/config.yaml

foo: bar

dev/stack.yaml

template:
  path: template1.yaml
parameters:
  Parm1: {{ foo2 }}

Expected behaviour

The error message should contain details of the config file containing the Jinja error, i.e.

"dev/stack.yaml - 'foo2' is undefined"

Actual behaviour

Only the Jinja error is currently output, i.e.

"'foo2' is undefined"

Solution

I am happy to raise a PR to improve this error message.

@X-Guardian, I believe you can show the whole stacktrace if you run Sceptre with the --debug flag. Can you try that and see if that resolves your issue?

--debug does show the stack name, along with potentially a lot of redundant debug output, especially for a large dependency tree. I don't feel users should need to see all this debug output just to get the name of the config file that contains the Jinja error.

I see your point there. Especially for simple ones. A PR to fix it would definitely be welcome. I agree adding the stack name would make the output better in those cases.