github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0025.yml (about) 1 doc_meta: | 2 folder: dvars 3 title: string literal 4 head: | 5 Showcase a dvar's value could reference to a object's sub element 6 7 sections: 8 - title: Yml string is essentially the object 9 content: | 10 This demo shows that a dvar stores a dynamic value, which is in yml format 11 12 The yml string could be converted to a object and registered in execution runtime. We will detail this later 13 14 - title: Demo 15 log: yes 16 17 18 notes: 19 goal: 20 - to show complex object using dynamic var 21 22 design: 23 - to make it simple, the dvar value is always a string 24 - | 25 the string could be a formated yaml, so that you can 26 convert it to yaml then a object 27 - register the object into that scope's vars list 28 - consider a modified name of -> a_smart_guy_obj to reference to 29 30 vars: 31 student: 32 name: Tom 33 gender: Male 34 school: Sydney Grammar 35 36 dvars: 37 - name: a_smart_guy 38 value: | 39 name: "{{.student.name}}" 40 sex: "{{.student.gender}}" 41 school: "{{.student.school}}" 42 43 tasks: 44 45 - name: task 46 task: 47 - 48 func: shell 49 do: 50 - echo """a smart guy=>{{.a_smart_guy}}"""