Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

enable strict mode during render #393

@shantanugadgil

Description

@shantanugadgil

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

$ cat curdate.tpl 
[[ .curdate ]]
[[ .something ]]
[[ .anything ]]

$ cat curdate.default.json 
{
        "something": "foo",
        "anything": "bar"
}

Output of levant version:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions