externalize settings
You can load dvars from a file. The configuration file will look much cleaner if you externalize the dvars settings
d0028_smart_guy.yml reference
name: Tom
gender: Male
school: Sydney Grammar
d0028_school.yml reference
address:
suburb:
name: {{.student.address.suburb.name}}
postcode: 2000
CBD: yes
school: {{.student.address.school}}
Demo
source
Main task yaml file
vars:
student:
name: Tom
gender: Male
address:
suburb:
name: sydney
postcode: 2000
CBD: yes
school: Sydney Grammar
dvars:
- name: a_smart_guy
ref: d0028_smart_guy.yml
flags: [toObj]
- name: school_address
ref: d0028_school.yml
flags: [toObj]
tasks:
- name: task
task:
- func: shell
do:
- echo """a smart guy=>{{.a_smart_guy}}"""
- echo """postcode=>{{.student.address.suburb.postcode}}"""
- echo """school address {{.school_address}}"""
- echo """this guy is in =>{{.a_smart_guy_object.school}} school"""
- echo """wrong ref here {{.school_address_object.suburb.name}}"""
- echo """school address object -> {{.school_address_object.address.suburb.name}}"""
Main log file
loading [Config]: ./tests/functests/upconfig.yml
Main config:
Version -> 1.0.0
RefDir -> ./tests/functests
WorkDir -> cwd
AbsWorkDir -> /up_project/up
TaskFile -> c0028
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/c0028
module: [self], instance id: [dev], exec profile: []
profile - envVars:
(*core.Cache)({
})
Task1: [task ==> task: ]
-Step1:
self: final context exec vars:
(*core.Cache)({
"a_smart_guy_object": {
"gender": "Male",
"school": "Sydney Grammar",
"name": "Tom"
},
"up_runtime_task_layer_number": 0,
"student": {
"name": "Tom",
"gender": "Male",
"address": {
"suburb": {
"name": "sydney",
"postcode": 2000,
"cbd": true
},
"school": "Sydney Grammar"
}
},
"school_address": "address:\n suburb:\n name: sydney\n postcode: 2000\n CBD: yes\n school: Sydney Grammar\n",
"school_address_object": {
"address": {
"school": "Sydney Grammar",
"suburb": {
"CBD": true,
"name": "sydney",
"postcode": 2000
}
}
},
"a_smart_guy": "name: Tom\ngender: Male\nschool: Sydney Grammar\n"
})
cmd( 1):
echo """a smart guy=>{{.a_smart_guy}}"""
-
a smart guy=>name: Tom
gender: Male
school: Sydney Grammar
-
.. ok
cmd( 2):
echo """postcode=>{{.student.address.suburb.postcode}}"""
-
postcode=>2000
-
.. ok
cmd( 3):
echo """school address {{.school_address}}"""
-
school address address:
suburb:
name: sydney
postcode: 2000
CBD: yes
school: Sydney Grammar
-
.. ok
cmd( 4):
echo """this guy is in =>{{.a_smart_guy_object.school}} school"""
-
this guy is in =>Sydney Grammar school
-
.. ok
cmd( 5):
echo """wrong ref here {{.school_address_object.suburb.name}}"""
-
wrong ref here <no value>
-
.. ok
cmd( 6):
echo """school address object -> {{.school_address_object.address.suburb.name}}"""
-
school address object -> sydney
-
.. ok
. ok
Logs with different verbose level
Raw logs with different verbose level