-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0172.yml
66 lines (54 loc) · 1.54 KB
/
c0172.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
doc_meta: |
folder: flow-controll
title: guaranteed final step to ensure clean up/rescue
head: |
Introduce to use finally/rescue in task step for a guranteed cleanup when task step has got panic
sections:
- title: Demo
log: yes
- title: what will happen if there is no rescue for the task without rescue
content: |
This showcases that the finally step invokes the close_file task to ensure the opened file is closed
The task will fail if there is no rescue to be "true", in this case, user choose to fail the task, or if rescue is set, then the execution will continue to the next func step call
related:
refs:
- title: shell func
link: ../../quick-start/c0002/
- title: error handling
link: ../../test-debug/error_handling/
- title: shell step fails
link: ../../flow-controll/f0171/
notes:
- add feature of finally run code
- add feature to rescue from panic
tasks:
-
name: task
task:
-
func: cmd
desc: step 1
do:
- name: print
cmd: step 1
- name: panic
- name: print
cmd: extra step ......... it will never reach here
rescue: true
finally: close_file
-
func: cmd
desc: step 2
do:
- name: print
cmd: step 2
-
name: close_file
task:
-
func: shell
name: close_file
desc: |
ensure the opened file is closed
do:
- echo "close the file ....."