github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0130.yml (about)

     1  doc_meta: |
     2    folder: block-func
     3    title: block in else
     4    head: |
     5      Add the support of execution of a flow using else tag
     6  
     7    sections:
     8      - title: Var auto merge applies the same to flow in else branch
     9        content: |
    10          Please notice that the values printed out in the else branch
    11  
    12      - title: Demo
    13        log: yes
    14  
    15  vars:
    16    a: global_aaa
    17    b: global_bbb
    18    c: global_ccc
    19    goahead: False
    20  #  goahead: True
    21  
    22  tasks:
    23    - name: task
    24      task:
    25  
    26        - func: block
    27          desc: show example the route goes to call goelse for the condition of not if condition succeeds
    28          vars:
    29            a: local_aaa
    30            b: local_bbb
    31          dvars:
    32            - name: da
    33              value: local_da
    34            - name: db
    35              value: local_db
    36          do:
    37            - func: shell
    38              do:
    39                - echo "shell step1"
    40                - echo "shell step2"
    41  
    42            - func: cmd
    43              vars:
    44                a: block_layer1_aaa
    45              do:
    46                -
    47                  name: print
    48                  cmd: |
    49                    layer 1
    50                    up_runtime_task_layer_number: {{.up_runtime_task_layer_number}}
    51                    a: {{.a}}
    52                    b: {{.b}}
    53                    c: {{.c}}
    54                    da: {{.da}}
    55                    db: {{.db}}
    56  
    57            - func: shell
    58              do:
    59                - echo "shell step3"
    60                - echo "shell step4"
    61  
    62            - func: block
    63              desc: test embeded 2nd layer of block
    64              vars:
    65                a: local_block_layer2_aaa
    66                b: local_block_layer2_bbb
    67              dvars:
    68                - name: da
    69                  value: local_da_layer2
    70                - name: db
    71                  value: local_db_layer2
    72              do:
    73                - func: cmd
    74                  vars:
    75                    a: block_layer2_aaa
    76                  do:
    77                    -
    78                      name: print
    79                      cmd: |
    80                        layer 2
    81                        up_runtime_task_layer_number: {{.up_runtime_task_layer_number}}
    82                        a: {{.a}}
    83                        b: {{.b}}
    84                        c: {{.c}}
    85                        da: {{.da}}
    86                        db: {{.db}}
    87  
    88            - func: shell
    89              do:
    90                - echo "shell step5"
    91                - echo "shell step6"
    92          if: '{{.goahead}}'
    93          else:
    94            - func: shell
    95              do:
    96                - echo "else step1"
    97                - echo "else step2"
    98  
    99            - func: cmd
   100              vars:
   101                a: block_layer1_aaa_else
   102              do:
   103                -
   104                  name: print
   105                  cmd: |
   106                    layer 1
   107                    up_runtime_task_layer_number: {{.up_runtime_task_layer_number}}
   108                    a: {{.a}}
   109                    b: {{.b}}
   110                    c: {{.c}}
   111                    da: {{.da}}
   112                    db: {{.db}}