(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:resource) op:Equal rhs:{(DQ (test))} spids:[94])]
      spids: [94]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:fstype) op:Equal rhs:{(DQ (UFS))} spids:[102])]
      spids: [102]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:pool) op:Equal rhs:{(DQ (test))} spids:[110])]
      spids: [110]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:mountpoint) op:Equal rhs:{(DQ (/mnt/test))} spids:[118])]
      spids: [118]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:device)
          op: Equal
          rhs: {(DQ (/dev/hast/) (${ VSub_Name resource))}
          spids: [129]
        )
      ]
      spids: [129]
    )
    (C {(export)} 
      {(Lit_VarLike 'PATH=') (/bin) (Lit_Other ':') (/sbin) (Lit_Other ':') (/usr/bin) (Lit_Other ':') 
        (/usr/sbin) (Lit_Other ':') (/usr/local/bin) (Lit_Other ':') (/usr/local/sbin)
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:sig) op:Equal rhs:{(DQ (TERM))} spids:[157])]
      spids: [157]
    )
    (ForEach
      iter_name: i
      iter_words: [
        {
          (CommandSubPart
            command_list: (CommandList children:[(C {(jot)} {(30)})])
            left_token: <Left_Backtick '`'>
            spids: [168 172]
          )
        }
      ]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:pgid)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [(C {(pgrep)} {(-f)} {(ucarp_up.sh)}) (C {(head)} {(-1)})]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [179 191]
                      )
                    }
                  spids: [178]
                )
              ]
              spids: [178]
            )
            (AndOr
              children: [
                (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name pgid))} {(Lit_Other ']')})
                (ControlFlow token:<ControlFlow_Break break>)
              ]
              op_id: Op_DPipe
            )
            (C {(kill)} {(-) (${ VSub_Name sig)} {(--)} {(-) (${ VSub_Name pgid)})
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:sig) op:Equal rhs:{(DQ (KILL))} spids:[226])]
              spids: [226]
            )
            (C {(sleep)} {(1)})
          ]
          spids: [175 236]
        )
      spids: [167 173]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name pgid))} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(logger)} {(-p)} {(local0.error)} {(-t)} {(hast)} 
              {
                (DQ ('UCARP UP process for resource ') (${ VSub_Name resource) 
                  (' is still running after 30 seconds.')
                )
              }
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 253]
        )
      ]
      spids: [-1 279]
    )
    (C {(logger)} {(-p)} {(local0.debug)} {(-t)} {(hast)} {(DQ ('UCARP UP is not running.'))})
    (Case
      to_match: {(DQ (${ VSub_Name fstype))}
      arms: [
        (case_arm
          pat_list: [{(UFS)}]
          action: [
            (Pipeline
              children: [(C {(mount)}) (C {(egrep)} {(-q)} {(DQ ('^') (${ VSub_Name device) (' on '))})]
              negated: False
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-eq)} {(0)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:out)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [{(umount)} {(-f)} {(DQ (${ VSub_Name mountpoint))}]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [359]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_Backtick '`'>
                                spids: [348 361]
                              )
                            }
                          spids: [347]
                        )
                      ]
                      spids: [347]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-ne)} {(0)} {(Lit_Other ']')})
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(logger)} {(-p)} {(local0.error)} {(-t)} {(hast)} 
                              {
                                (DQ ('Unable to unmount file system for resource ') 
                                  (${ VSub_Name resource) (': ') (${ VSub_Name out) (.)
                                )
                              }
                            )
                            (C {(exit)} {(1)})
                          ]
                          spids: [-1 377]
                        )
                      ]
                      spids: [-1 408]
                    )
                    (C {(logger)} {(-p)} {(local0.debug)} {(-t)} {(hast)} 
                      {(DQ ('File system for resource ') (${ VSub_Name resource) (' unmounted.'))}
                    )
                  ]
                  spids: [-1 340]
                )
              ]
              spids: [-1 430]
            )
          ]
          spids: [306 307 433 -1]
        )
        (case_arm
          pat_list: [{(ZFS)}]
          action: [
            (Pipeline
              children: [
                (C {(zpool)} {(list)})
                (C {(egrep)} {(-q)} {(DQ ('^') (${ VSub_Name pool) (' '))})
              ]
              negated: False
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-eq)} {(0)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:out)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [{(zpool)} {(export)} {(-f)} {(DQ (${ VSub_Name pool))}]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [492]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_Backtick '`'>
                                spids: [479 494]
                              )
                            }
                          spids: [478]
                        )
                      ]
                      spids: [478]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-ne)} {(0)} {(Lit_Other ']')})
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(logger)} {(-p)} {(local0.error)} {(-t)} {(hast)} 
                              {
                                (DQ ('Unable to export pool for resource ') (${ VSub_Name resource) 
                                  (': ') (${ VSub_Name out) (.)
                                )
                              }
                            )
                            (C {(exit)} {(1)})
                          ]
                          spids: [-1 510]
                        )
                      ]
                      spids: [-1 541]
                    )
                    (C {(logger)} {(-p)} {(local0.debug)} {(-t)} {(hast)} 
                      {(DQ ('ZFS pool for resource ') (${ VSub_Name resource) (' exported.'))}
                    )
                  ]
                  spids: [-1 471]
                )
              ]
              spids: [-1 563]
            )
          ]
          spids: [435 436 566 -1]
        )
      ]
      spids: [296 304 568]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:out)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (SimpleCommand
                        words: [{(hastctl)} {(role)} {(secondary)} {(DQ (${ VSub_Name resource))}]
                        redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[588])]
                      )
                    ]
                  )
                left_token: <Left_Backtick '`'>
                spids: [575 590]
              )
            }
          spids: [574]
        )
      ]
      spids: [574]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-ne)} {(0)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(logger)} {(-p)} {(local0.error)} {(-t)} {(hast)} 
              {
                (DQ ('Unable to change to role to secondary for resource ') (${ VSub_Name resource) 
                  (': ') (${ VSub_Name out) (.)
                )
              }
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 605]
        )
      ]
      spids: [-1 635]
    )
    (C {(logger)} {(-p)} {(local0.debug)} {(-t)} {(hast)} 
      {(DQ ('Role for resource ') (${ VSub_Name resource) (' changed to secondary.'))}
    )
    (C {(logger)} {(-p)} {(local0.info)} {(-t)} {(hast)} 
      {(DQ ('Successfully switched to secondary for resource ') (${ VSub_Name resource) (.))}
    )
    (C {(exit)} {(0)})
  ]
)