Skip to content

assert

Source

Hook for asserting an input is equal to a value.

Inputs

Name Type Default Required Description
input Any True The input - ie right hand side of assert.
value Any None False The value - ie left hand side of assert.
exit_on_failure bool True True Whether to exit on assertion error.

Arguments

Position Argument Type
1 input Any
2 value Any

Returns

bool

Examples

Assert if two items are equal. Can also easily be done with jinja but with this hook you can exit based on the assertion.

stuff: things
assertion->: assert {{stuff}} things  # Would exit otherwise
with-jinja->: {{stuff!='things'}}  # Equivalent and would not exit
# `assert` is a special key as well and skips output
assert->: things {{stuff}}
# Note - this does not work because of yaml parsing error
#assert->: "{{stuff}}" things

stuff: things
assertion: true
with-jinja: false