-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0034.yml
154 lines (138 loc) · 3.53 KB
/
c0034.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
TODO:
- not clear if dvar in calleed should be overriden as well??
- need a review on this later on
doc_meta: |
folder: dvars
title: dvars in call
head: |
Demo dvars merge in local scope in execution time
sections:
- title: Note
content: |
* school object in callee
- title: Demo
log: yes
notes:
goal:
- dvars expand in call level
- dvars object can merge in leaf level
- dvar in call task will override same name dvar in local level
expected:
- school object in nonprod could append new element and
- also override same name element
result_log: |
cmd( 1):
echo """1.school -> {{.school}}"""
1.school -> address:
state: NSW
city: sydney
suburb:
name: sydney
postcode: 2000
CBD: LOCAL
school: Sydney Grammar
principal: Mr Right
cmd( 2):
echo """2.school object CBD -> {{.school_object.address.suburb.CBD}}"""
2.school object CBD -> LOCAL
cmd( 3):
echo """3.school object-> {{.school_object.address.school}}"""
3.school object-> Sydney Grammar
cmd( 4):
echo """4.school object-> {{.school_object.principal}}"""
4.school object-> Mr Right
cmd( 5):
echo """5.a {{.a}}"""
5.a local-a
cmd( 6):
echo """6.b {{.b}}"""
6.b local-b
scopes:
-
name: global
vars:
student:
name: Tom
gender: Male
address:
suburb:
name: sydney
postcode: 2000
CBD: yes
school: Sydney Grammar
-
name: nonprod
members:
- dev
- staging
vars:
a: non-prod-a
b: non-prod-b
c: non-prod-c
d: non-prod-d
dvars:
- name: school
value: |
address:
suburb:
name: {{.student.address.suburb.name}}
postcode: 2000
CBD: yes
school: {{.student.address.school}}
flags: [toObj]
-
name: dev
tasks:
-
name: task
task:
-
func: call
vars:
a: local-a
b: local-b
dvars:
- name: school
value: |
address:
state: NSW
city: sydney
suburb:
name: {{.student.address.suburb.name}}
postcode: 2000
CBD: LOCAL
school: {{.student.address.school}}
principal: Mr Right
flags: [toObj]
do:
- show_school_details
-
name: show_school_details
task:
-
func: shell
vars:
a: show-school-details-a
b: show-school-details-b
dvars:
- name: class_room
value: 3K
- name: school
value: |
address:
suburb:
name: {{.student.address.suburb.name}}
postcode: 2000
CBD: no
school: {{.student.address.school}}
principal: Mr Peter
something: ref task does not have this field
flags: [toObj]
do:
- echo """1.school -> {{.school}}"""
- echo """2.school object CBD -> {{.school_object.address.suburb.CBD}}"""
- echo """3.school object-> {{.school_object.address.school}}"""
- echo """4.school object-> {{.school_object.principal}}"""
- echo """5.a {{.a}}"""
- echo """6.b {{.b}}"""
- echo """7.school object-> {{.school_object|printObj}}"""