Most of the case, this is due to the non-exist variable of given path
vars:
person:
name: tom
tasks:
- name: task
task:
- func: cmd
desc: |
the commented if statement will cause a template rendering issue since person.school is not able to be determined
do:
- name: print
cmd: "hello: {{.person.name}}"
- func: cmd
# if: '{{eq .person.school "None"}}'
desc: |
correct way is to try to get the school value and save it to a dvar
then it is deterministic of the school value
dvars:
- name: school
value: '{{.person.school}}'
do:
- name: print
cmd: "hello: {{.person.name}}"
if: '{{eq .school "None"}}'
else:
- func: cmd
desc: now it is safe to access school from person object
do:
- name: print
cmd: "hello: {{.person.name}} from {{.person.school}}"
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0157
Verbose -> vvv
ModuleName -> self
ShellType -> /bin/sh
MaxCallLayers -> 8
Timeout -> 3600000
MaxModuelCallLayers -> 256
EntryTask -> task
ModRepoUsernameRef ->
ModRepoPasswordRef ->
work dir: /up_project/up
-exec task: task
loading [Task]: ./tests/functests/c0157
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1: [
the commented if statement will cause a template rendering issue since person.school is not able to be determined
]
self: final context exec vars:
(*core.Cache)({
"person": {
"name": "tom"
},
"up_runtime_task_layer_number": 0
})
~SubStep1: [print: ]
hello: tom
-Step2: [
correct way is to try to get the school value and save it to a dvar
then it is deterministic of the school value
]
self: final context exec vars:
(*core.Cache)({
"school": "None",
"person": {
"name": "tom"
},
"up_runtime_task_layer_number": 0
})
~SubStep1: [print: ]
hello: tom