(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: (bool_expr.Unary op_id:BoolUnary_z child:{(DQ ($ VSub_Number '$1'))})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Usage: ') ($ VSub_Number '$0') (' add|remove (hostname)'))})
            (command.ControlFlow token:<ControlFlow_Exit exit>)
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: (bool_expr.Unary op_id:BoolUnary_z child:{(DQ ($ VSub_Number '$2'))})
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:EXACTHOST)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.Assignment
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:TRANSCRIPT)
          op: Equal
          rhs: {(DQ (cobbler-transcript.txt))}
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: (bool_expr.Unary op_id:BoolUnary_f child:{($ VSub_DollarName '$TRANSCRIPT')})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(touch)} {($ VSub_DollarName '$TRANSCRIPT')})]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DBracket expr:(bool_expr.Unary op_id:BoolUnary_f child:{(cluster.txt)}))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Using cluster definition from cluster.txt'))})
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [
                (command.Sentence
                  child: 
                    (C {(read)} {(HOSTNAME)} {(MACADDR)} {(IPADDR)} {(ILOIPADDR)} {(DOMAIN)} {(ROLE)})
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: BoolBinary_GlobEqual
                                      left: {($ VSub_DollarName '$HOSTNAME')}
                                      right: {(DQ (end))}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(command.ControlFlow token:<ControlFlow_Continue continue>)]
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: BoolBinary_GlobEqual
                                      left: {(DQ ($ VSub_DollarName '$ROLE'))}
                                      right: {(DQ (bootstrap))}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(command.ControlFlow token:<ControlFlow_Continue continue>)]
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: BoolBinary_GlobEqual
                                      left: {($ VSub_Number '$1')}
                                      right: {(add)}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.If
                              arms: [
                                (if_arm
                                  cond: [
                                    (command.Sentence
                                      child: 
                                        (command.DBracket
                                          expr: 
                                            (bool_expr.LogicalOr
                                              left: 
                                                (bool_expr.Unary
                                                  op_id: BoolUnary_z
                                                  child: {(DQ ($ VSub_DollarName '$EXACTHOST'))}
                                                )
                                              right: 
                                                (bool_expr.LogicalOr
                                                  left: 
                                                    (bool_expr.Binary
                                                      op_id: BoolBinary_GlobEqual
                                                      left: {(DQ ($ VSub_DollarName '$EXACTHOST'))}
                                                      right: {(DQ ($ VSub_DollarName '$HOSTNAME'))}
                                                    )
                                                  right: 
                                                    (bool_expr.Binary
                                                      op_id: BoolBinary_GlobEqual
                                                      left: {(DQ ($ VSub_DollarName '$EXACTHOST'))}
                                                      right: {(DQ ($ VSub_DollarName '$ROLE'))}
                                                    )
                                                )
                                            )
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                  ]
                                  action: [
                                    (command.Assignment
                                      pairs: [
                                        (assign_pair
                                          lhs: (lhs_expr.LhsName name:MATCH)
                                          op: Equal
                                          rhs: {(DQ ($ VSub_DollarName '$HOSTNAME'))}
                                        )
                                      ]
                                    )
                                    (command.Assignment
                                      pairs: [
                                        (assign_pair
                                          lhs: (lhs_expr.LhsName name:ACTIONSTRING)
                                          op: Equal
                                          rhs: 
                                            {
                                              (DQ ('adding ') ($ VSub_DollarName '$HOSTNAME') (.) 
                                                ($ VSub_DollarName '$DOMAIN') (' (') ($ VSub_DollarName '$IPADDR') (',') ($ VSub_DollarName '$MACADDR') (') to cobbler...')
                                              )
                                            }
                                        )
                                      ]
                                    )
                                    (command.Pipeline
                                      children: [
                                        (C {(echo)} {($ VSub_DollarName '$ACTIONSTRING')})
                                        (C {(tee)} {(-a)} {($ VSub_DollarName '$TRANSCRIPT')})
                                      ]
                                      negated: F
                                    )
                                    (C {(sudo)} {(cobbler)} {(system)} {(add)} 
                                      {(--name) (Lit_Other '=') ($ VSub_DollarName '$HOSTNAME')} {(--hostname) (Lit_Other '=') ($ VSub_DollarName '$HOSTNAME') (.) ($ VSub_DollarName '$DOMAIN')} 
                                      {(--profile) (Lit_Other '=') (bcpc_host)} {(--ip-address) (Lit_Other '=') ($ VSub_DollarName '$IPADDR')} 
                                      {(--mac) (Lit_Other '=') ($ VSub_DollarName '$MACADDR')} {(--interface) (Lit_Other '=') (eth0)}
                                    )
                                  ]
                                )
                              ]
                            )
                          ]
                        )
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: BoolBinary_GlobDEqual
                                      left: {($ VSub_Number '$1')}
                                      right: {(remove)}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.If
                              arms: [
                                (if_arm
                                  cond: [
                                    (command.Sentence
                                      child: 
                                        (command.DBracket
                                          expr: 
                                            (bool_expr.LogicalOr
                                              left: 
                                                (bool_expr.Unary
                                                  op_id: BoolUnary_z
                                                  child: {(DQ ($ VSub_DollarName '$EXACTHOST'))}
                                                )
                                              right: 
                                                (bool_expr.LogicalOr
                                                  left: 
                                                    (bool_expr.Binary
                                                      op_id: BoolBinary_GlobEqual
                                                      left: {(DQ ($ VSub_DollarName '$EXACTHOST'))}
                                                      right: {(DQ ($ VSub_DollarName '$HOSTNAME'))}
                                                    )
                                                  right: 
                                                    (bool_expr.Binary
                                                      op_id: BoolBinary_GlobEqual
                                                      left: {(DQ ($ VSub_DollarName '$EXACTHOST'))}
                                                      right: {(DQ ($ VSub_DollarName '$ROLE'))}
                                                    )
                                                )
                                            )
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                  ]
                                  action: [
                                    (command.Assignment
                                      pairs: [
                                        (assign_pair
                                          lhs: (lhs_expr.LhsName name:MATCH)
                                          op: Equal
                                          rhs: {(DQ ($ VSub_DollarName '$HOSTNAME'))}
                                        )
                                      ]
                                    )
                                    (command.Assignment
                                      pairs: [
                                        (assign_pair
                                          lhs: (lhs_expr.LhsName name:ACTIONSTRING)
                                          op: Equal
                                          rhs: 
                                            {
                                              (DQ ('removing ') ($ VSub_DollarName '$HOSTNAME') 
                                                (' from cobbler...')
                                              )
                                            }
                                        )
                                      ]
                                    )
                                    (command.Pipeline
                                      children: [
                                        (C {(echo)} {($ VSub_DollarName '$ACTIONSTRING')})
                                        (C {(tee)} {(-a)} {($ VSub_DollarName '$TRANSCRIPT')})
                                      ]
                                      negated: F
                                    )
                                    (C {(sudo)} {(cobbler)} {(system)} {(remove)} 
                                      {(--name) (Lit_Other '=') ($ VSub_DollarName '$HOSTNAME')}
                                    )
                                  ]
                                )
                              ]
                            )
                          ]
                        )
                      ]
                      else_action: [
                        (C {(echo)} 
                          {
                            (DQ ('Usage: ') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) 
                              ($ VSub_Number '$1') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (' unrecognized')
                            )
                          }
                        )
                        (command.ControlFlow token:<ControlFlow_Exit exit>)
                      ]
                    )
                  ]
                )
              redirects: [(redir.Redir op:<Redir_Less '<'> fd:16777215 arg_word:{(cluster.txt)})]
            )
          ]
        )
      ]
      else_action: [
        (C {(echo)} {(DQ ('Error: No cluster definition (cluster.txt) available'))})
        (command.ControlFlow token:<ControlFlow_Exit exit>)
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: 
                        (bool_expr.Unary
                          op_id: BoolUnary_z
                          child: {(DQ ($ VSub_DollarName '$MATCH'))}
                        )
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(echo)} {(DQ ('Cobbler sync...'))}) (C {(sudo)} {(cobbler)} {(sync)})]
        )
      ]
      else_action: [
        (command.If
          arms: [
            (if_arm
              cond: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Unary
                          op_id: BoolUnary_z
                          child: {(DQ ($ VSub_DollarName '$EXACTHOST'))}
                        )
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [
                (C {(echo)} {(No)} {(hosts)} {(defined) (Lit_Comma ',')} {(no)} {(action)} {(taken.)})
              ]
            )
          ]
          else_action: [
            (C {(echo)} {(Error)} {(Lit_Other ':')} {(Host)} {(DQ ("'") ($ VSub_Number '$2') ("'"))} 
              {(unrecognized) (Lit_Comma ',')} {(no)} {(action)} {(taken.)}
            )
          ]
        )
      ]
    )
  ]
)