You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add option for strict mode during render
If/when a variable is not defined during rendering, cause the render to fail with non-zero rather than continue.
Levant v0.3.0-beta1 (bb0922f6)
$ levant render -var-file curdate.default.json -var "curdate1=$(date +'%Y-%m-%d')" curdate.tpl
2021-01-21T07:29:25-08:00 |INFO| helper/variable: using command line variable with key curdate1 and value 2021-01-21
2021-01-21T07:29:25-08:00 |INFO| helper/variable: using variable with key something and value foo from file
2021-01-21T07:29:25-08:00 |INFO| helper/variable: using variable with key anything and value bar from file
<no value>
foo
bar
$ echo $?
0
notice purposeful typo of input variable curdate
Output of consul version:
n/a
Output of nomad version:
n/a
The text was updated successfully, but these errors were encountered:
You can currently create strict behavior in 0.3.0-beta by testing the variable and using the Sprig fail function. However, there is some art on making this an all-or-nothing option at the command line too (#308).
Bingo. I can use fail for a few variables, but becomes unwieldy soon.
I didn't know the PR #308 existed, but I second that entirely!!!
In fact I would favor strict as the default (with an option of no-strict or relaxed, but curious why would anyone explicitly want relaxed mode?)
EDIT: My only real requirement was a non-zero return to be able to bail from some automation scripts. Any specific error messages would be obviously helpful. 😁
add option for strict mode during render
If/when a variable is not defined during rendering, cause the
render
to fail with non-zero rather than continue.Relevant Nomad job specification file
Output of
levant version
:notice purposeful typo of input variable
curdate
Output of
consul version
:Output of
nomad version
:The text was updated successfully, but these errors were encountered: