-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Liquid::UndefinedVariable is raised for defined attribute with nil value, when strict_variables: true #749
Comments
That seems like a bug to me. |
The current CLI stacks YAML reader uses `Liquid::Template.render(..., strict_variables: true)`. This means that that any references to undefined variables will omit the tag from the output and push an error message into `template.errors`. The CLI ignores those errors, which cascades into other difficult to debug issues when parts are missing from the resulting YAML: * #1846 * #1890 A Liquid bug also means that optional `required: false` stack variables also behave as undefined variables: Shopify/liquid#749 This PR fixes the CLI stack YAML reader to: * Workaround Liquid bugs to treat optional `required: false` stack variables as falsey values for Liquid conditional blocks * Fail `kontena stack ...` fast with a `Liquid error: undefined variable ... ` message if the YAML contains invalid variable references. These errors would be nicer if they also contained the source YAML `file:line`, but that is missing from the `Liquid::UndefinedVariable` error...
We currently have the same problem. Variable is defined but The check for If there is any chance that this gets accepted i'll craft a PR. Let me know. |
Happy to look at a PR |
Looks like this issue was fixed by a979b3e |
Is this desired behaviour?
We want to be strict for variables being defined, nil value is allowed because we handle that with an if.
The text was updated successfully, but these errors were encountered: