Skip to content

make config tolerant to no value #445

Answered by gcheadle-vmware
rafikt1992 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rafikt1992 👋

I see your edit and that you have found a solution 👍
Some helpful documentation for this question lives in our FAQ doc under the Data Values section.
One note is that @ data.values is already a struct, thus it has a function to test the existence of a key, this function is hasattr():

#@ load("@ytt:data", "data")
foo: #@ data.value.foo
#@ if/end hasattr(data.values, "bar"):
bar: #@ data.value.bar

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rafikt1992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants