lukasjarosch / skipper

Inventory based templated configuration library inspired by the kapitan project
https://lukasjarosch.github.io/skipper/
MIT License
11 stars 3 forks source link

feat: improve variable handling #61

Open lukasjarosch opened 1 year ago

andaryjo commented 1 year ago

@lukasjarosch These changes do not seem to resolve the problem we discussed. Trying to reference a class that goes by the same name as the yaml key still throws the same error, just less helpful this time 😄

Previous:

jandary@mbp doratheexplorer % go run main.go
reference to invalid variable '${flags:sandbox}': unexpected node type string at index 1

With skipper on feat/improve-template-undefined-value-handling:

jandary@mbp doratheexplorer % go run main.go
unexpected node type string at index 1
andaryjo commented 1 year ago

My bad, on the second try it somehow worked:

jandary@mbp doratheexplorer % go run main.go
recursive variable usage found at path 'features': ${features:sandbox}
andaryjo commented 1 year ago

Demo setup of what I'm trying to achieve here: https://github.com/andaryjo/doratheexplorer/tree/0805d9f440cbbd06a0c20158cad2a2c13449cd5e

lukasjarosch commented 1 year ago

I'd love to see the demo setup, but the Repo seems to be private 😄

lukasjarosch commented 1 year ago

I have reviewed your demo and it did indeed not behave as expected. The recursion detection was not working properly. I've now improved the error messages and fixed up the recursion detection.

With your example you should now receive:

cannot load target data for variable ${features:sandbox}: GetPath: undefined path: [features sandbox]

This is now indeed what a user would expect at this point, don't you think?