-
Notifications
You must be signed in to change notification settings - Fork 132
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
Referencing a non-existing stack variable error is hard to understand #1846
Comments
What kind of yml does this come from? It should say "Undeclared variable 'foo' ...." if you're trying to use an unknown one. |
see
|
It looks like the stackfile interpolation results in stack: test/variables
variables:
asdf:
type: string
default: asdf
services:
test:
image: redis
affinity:
- {{ asdflol }} Results in the following {"stack"=>"test/variables", "variables"=>{"asdf"=>{"type"=>"string", "default"=>"asdf"}}, "services"=>{"test"=>{"image"=>"redis", "affinity"=>[nil]}}} The
|
The [#<Liquid::UndefinedVariable: Liquid error: undefined variable asdflol>] The reader should probably just use
|
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...
The text was updated successfully, but these errors were encountered: