(command.CommandList
  children: [
    (C {(echo)} {(DQ ('this is not working yet'))})
    (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:22))
    (C {(source)} {(./virtualbox_env.sh)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:UP)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_Backtick val:'`' span_id:34)
                command_list: 
                  (command.CommandList
                    children: [
                      (command.Pipeline
                        children: [
                          (C {($ Id.VSub_DollarName '$VBM')} {(showvminfo)} {(bcpc-bootstrap)})
                          (C {(grep)} {(-i)} {(State)})
                        ]
                        negated: F
                      )
                    ]
                  )
              )
            }
          spids: [33]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalNot
                      child: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_EqualTilde
                          left: {($ Id.VSub_DollarName '$UP')}
                          right: {(running)}
                        )
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:65)
            )
          ]
          action: [
            (C {($ Id.VSub_DollarName '$VBM')} {(startvm)} {(bcpc-bootstrap)})
            (C {(sleep)} {(30)})
          ]
          spids: [52 67]
        )
      ]
      else_action: [(C {(echo)} {(DQ ('bcpc-bootstrap is running'))})]
    )
    (C {(./vm-to-cluster.sh)} {(bloomberg.com)})
    (command.WhileUntil
      keyword: (Token id:Id.KW_While val:while span_id:103)
      cond: [
        (command.Sentence
          child: (C {(read)} {(HOSTNAME)} {(MACADDR)} {(IPADDR)} {(ILOIPADDR)} {(DOMAIN)} {(ROLE)})
          terminator: (Token id:Id.Op_Semi val:';' span_id:118)
        )
      ]
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobEqual
                              left: {($ Id.VSub_DollarName '$HOSTNAME')}
                              right: {(DQ (end))}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:136)
                    )
                  ]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ControlFlow
                          token: (Token id:Id.ControlFlow_Break val:break span_id:141)
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:142)
                    )
                  ]
                  spids: [123 138]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobEqual
                              left: {(DQ ($ Id.VSub_DollarName '$HOSTNAME'))}
                              right: {(bcpc-bootstrap)}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:161)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:NATADDR)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$IPADDR')}
                          spids: [166]
                        )
                      ]
                    )
                    (C {(echo)} 
                      {
                        (DQ ('bcpc-bootstrap is currently at (NAT) address ') 
                          ($ Id.VSub_DollarName '$NATADDR')
                        )
                      }
                    )
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Break val:break span_id:178)
                    )
                  ]
                  spids: [148 163]
                )
              ]
            )
          ]
        )
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Less val:'<' span_id:185)
          fd: -1
          arg_word: {(cluster.txt)}
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_z
                      child: {($ Id.VSub_DollarName '$NATADDR')}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:198)
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Couldn't find the bootstrap node's IP address"))})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:210)
              arg_word: {(1)}
            )
          ]
          spids: [189 200]
        )
      ]
      else_action: [
        (command.ForEach
          iter_name: ATTEMPT
          iter_words: [{(A)} {(B)} {(C)} {(D)} {(E)} {(F)} {(G)}]
          do_arg_iter: F
          body: 
            (command.DoGroup
              children: [
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: (bool_expr.WordTest w:{(DQ ($ Id.VSub_Number '$1'))})
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:251)
                        )
                      ]
                      action: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:HOST)
                              op: assign_op.Equal
                              rhs: {(DQ ($ Id.VSub_Number '$1'))}
                              spids: [256]
                            )
                          ]
                        )
                      ]
                      spids: [242 253]
                    )
                  ]
                  else_action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:HOST)
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_DollarName '$NATADDR'))}
                          spids: [265]
                        )
                      ]
                    )
                  ]
                )
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.Simple
                              words: [{(hash)} {(fping)}]
                              redirects: [
                                (redir.Redir
                                  op: (Token id:Id.Redir_Great val:'2>' span_id:280)
                                  fd: 2
                                  arg_word: {(/dev/null)}
                                )
                              ]
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:282)
                        )
                      ]
                      action: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:UP)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (command_sub
                                    left_token: (Token id:Id.Left_Backtick val:'`' span_id:288)
                                    command_list: 
                                      (command.CommandList
                                        children: [
                                          (command.Pipeline
                                            children: [
                                              (C {(fping)} {(-aq)} {(${ Id.VSub_Name HOST)})
                                              (C {(awk)} 
                                                {
                                                  (SQ 
                                                    (Token
                                                      id: Id.Lit_Chars
                                                      val: '{print $1}'
                                                      span_id: 304
                                                    )
                                                  )
                                                }
                                              )
                                            ]
                                            negated: F
                                          )
                                        ]
                                      )
                                  )
                                }
                              spids: [287]
                            )
                          ]
                        )
                      ]
                      spids: [274 284]
                    )
                  ]
                  else_action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:UP)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: (Token id:Id.Left_Backtick val:'`' span_id:313)
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (command.Pipeline
                                        children: [
                                          (C {(ping)} {(-c)} {(1)} {(${ Id.VSub_Name HOST)})
                                          (C {(grep)} {(ttl)})
                                          (C {(cut)} {(-f4)} {(-d) (DQ (' '))})
                                          (C {(cut)} {(-f1)} {(-d) (DQ (':'))})
                                        ]
                                        negated: F
                                      )
                                    ]
                                  )
                              )
                            }
                          spids: [312]
                        )
                      ]
                    )
                  ]
                )
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Unary
                                  op_id: Id.BoolUnary_z
                                  child: {(DQ ($ Id.VSub_DollarName '$UP'))}
                                )
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:369)
                        )
                      ]
                      action: [
                        (C {(echo)} {(DQ ('VM is not up yet or is unreachable'))})
                        (command.If
                          arms: [
                            (if_arm
                              cond: [
                                (command.Sentence
                                  child: 
                                    (command.DBracket
                                      expr: 
                                        (bool_expr.Binary
                                          op_id: Id.BoolBinary_GlobEqual
                                          left: {($ Id.VSub_DollarName '$ATTEMPT')}
                                          right: {(G)}
                                        )
                                    )
                                  terminator: (Token id:Id.Op_Semi val:';' span_id:392)
                                )
                              ]
                              action: [
                                (C {(echo)} 
                                  {(DQ ("Maybe machine needs rework. Rerun this when it's up"))}
                                )
                                (command.ControlFlow
                                  token: (Token id:Id.ControlFlow_Exit val:exit span_id:404)
                                  arg_word: {(1)}
                                )
                              ]
                              spids: [381 394]
                            )
                          ]
                        )
                        (C {(sleep)} {(5)})
                      ]
                      spids: [358 371]
                    )
                  ]
                  else_action: [
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Break val:break span_id:420)
                    )
                  ]
                )
              ]
            )
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:SSHCOMMON)
              op: assign_op.Equal
              rhs: 
                {
                  (DQ 
                    (
'-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o VerifyHostKeyDNS=no'
                    )
                  )
                }
              spids: [429]
            )
          ]
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:SSHCMD)
              op: assign_op.Equal
              rhs: {(DQ ('ssh ') ($ Id.VSub_DollarName '$SSHCOMMON'))}
              spids: [435]
            )
          ]
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:SCPCMD)
              op: assign_op.Equal
              rhs: {(DQ ('scp ') ($ Id.VSub_DollarName '$SSHCOMMON'))}
              spids: [442]
            )
          ]
        )
        (command.If
          arms: [
            (if_arm
              cond: [
                (command.Sentence
                  child: 
                    (command.Simple
                      words: [{(hash)} {(sshpass)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Great val:'2>' span_id:455)
                          fd: 2
                          arg_word: {(/dev/null)}
                        )
                      ]
                    )
                  terminator: (Token id:Id.Op_Semi val:';' span_id:457)
                )
              ]
              action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:EDITED)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (command_sub
                            left_token: (Token id:Id.Left_Backtick val:'`' span_id:463)
                            command_list: 
                              (command.CommandList
                                children: [
                                  (C {(sshpass)} {(-p)} {(ubuntu)} {($ Id.VSub_DollarName '$SSHCMD')} 
                                    {(-t)} {(ubuntu) (Id.Lit_Other '@') ($ Id.VSub_DollarName '$HOST')} 
                                    {
                                      (DQ 
                                        (
"echo ubuntu | sudo -S grep 'Static interfaces' /etc/network/interfaces"
                                        )
                                      )
                                    }
                                  )
                                ]
                              )
                          )
                        }
                      spids: [462]
                    )
                  ]
                )
                (C {(echo)} {(DQ ('EDITED = ') ($ Id.VSub_DollarName '$EDITED'))})
              ]
              spids: [449 459]
            )
          ]
          else_action: [
            (C {(echo)} {(DQ ('please install sshpass'))})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:504)
              arg_word: {(1)}
            )
          ]
        )
        (command.If
          arms: [
            (if_arm
              cond: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_EqualTilde
                          left: {(DQ ($ Id.VSub_DollarName '$EDITED'))}
                          right: {(DQ ('Static interfaces'))}
                        )
                    )
                  terminator: (Token id:Id.Op_Semi val:';' span_id:527)
                )
              ]
              action: [
                (C {(echo)} {(DQ ('interfaces file appears adjusted already'))})
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Exit val:exit span_id:539)
                  arg_word: {(0)}
                )
              ]
              spids: [512 529]
            )
          ]
          else_action: [
            (C {(echo)} {(DQ ('copy interfaces file fragment...'))})
            (C {(sshpass)} {(-p)} {(ubuntu)} {($ Id.VSub_DollarName '$SCPCMD')} {(-p)} {(DQ (vm-eth.txt))} 
              {(DQ ('ubuntu@') ($ Id.VSub_DollarName '$HOST') (':/tmp'))}
            )
            (C {(echo)} {(DQ ('add the network definitions'))})
            (C {(sshpass)} {(-p)} {(ubuntu)} {($ Id.VSub_DollarName '$SSHCMD')} {(-t)} 
              {(ubuntu) (Id.Lit_Other '@') ($ Id.VSub_DollarName '$HOST')} {(DQ ('echo ubuntu | sudo -S cp -p /etc/network/interfaces /etc/network/interfaces.orig'))}
            )
            (C {(sshpass)} {(-p)} {(ubuntu)} {($ Id.VSub_DollarName '$SSHCMD')} {(-t)} 
              {(ubuntu) (Id.Lit_Other '@') ($ Id.VSub_DollarName '$HOST')} {(DQ ('echo ubuntu | sudo -S cat /etc/network/interfaces /tmp/vm-eth.txt > /tmp/combined.txt'))}
            )
            (C {(sshpass)} {(-p)} {(ubuntu)} {($ Id.VSub_DollarName '$SSHCMD')} {(-t)} 
              {(ubuntu) (Id.Lit_Other '@') ($ Id.VSub_DollarName '$HOST')} {(DQ ('echo ubuntu | sudo -S mv /tmp/combined.txt /etc/network/interfaces'))}
            )
            (C {(echo)} {(DQ ('restart networking'))})
            (C {(sshpass)} {(-p)} {(ubuntu)} {($ Id.VSub_DollarName '$SSHCMD')} {(-t)} 
              {(ubuntu) (Id.Lit_Other '@') ($ Id.VSub_DollarName '$HOST')} {(DQ ('echo ubuntu | sudo -S service networking restart'))}
            )
          ]
        )
      ]
    )
  ]
)