(command.CommandList
  children: [
    (C {<echo>} {(DQ <'this is not working yet'>)})
    (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
    (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: <Id.Left_Backtick '`'>
                child: 
                  (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: 
            (condition.Shell
              commands: [
                (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: <Id.Op_Semi _>
                )
              ]
            )
          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: <Id.KW_While while>
      cond: 
        (condition.Shell
          commands: [
            (command.Sentence
              child: (C {<read>} {<HOSTNAME>} {<MACADDR>} {<IPADDR>} {<ILOIPADDR>} {<DOMAIN>} {<ROLE>})
              terminator: <Id.Op_Semi _>
            )
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_GlobEqual
                                  left: {($ Id.VSub_DollarName '$HOSTNAME')}
                                  right: {(DQ <end>)}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Sentence
                      child: (command.ControlFlow token:<Id.ControlFlow_Break break>)
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  spids: [123 138]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_GlobEqual
                                  left: {(DQ ($ Id.VSub_DollarName '$HOSTNAME'))}
                                  right: {<bcpc-bootstrap>}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  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:<Id.ControlFlow_Break break>)
                  ]
                  spids: [148 163]
                )
              ]
            )
          ]
        )
      redirects: [(redir op:<Id.Redir_Less '<'> loc:(redir_loc.Fd fd:0) arg:{<cluster.txt>})]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Unary
                          op_id: Id.BoolUnary_z
                          child: {($ Id.VSub_DollarName '$NATADDR')}
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'Couldn\'t find the bootstrap node\'s IP address'>)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [189 200]
        )
      ]
      else_action: [
        (command.ForEach
          iter_names: [ATTEMPT]
          iterable: (for_iter.Words words:[{<A>} {<B>} {<C>} {<D>} {<E>} {<F>} {<G>}])
          body: 
            (command.DoGroup
              children: [
                (command.If
                  arms: [
                    (if_arm
                      cond: 
                        (condition.Shell
                          commands: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: (bool_expr.WordTest w:{(DQ ($ Id.VSub_Number '$1'))})
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      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: 
                        (condition.Shell
                          commands: [
                            (command.Sentence
                              child: 
                                (command.Simple
                                  words: [{<hash>} {<fping>}]
                                  redirects: [
                                    (redir
                                      op: <Id.Redir_Great '2>'>
                                      loc: (redir_loc.Fd fd:2)
                                      arg: {<'/dev/null'>}
                                    )
                                  ]
                                  do_fork: T
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      action: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:UP)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (command_sub
                                    left_token: <Id.Left_Backtick '`'>
                                    child: 
                                      (command.Pipeline
                                        children: [
                                          (C {<fping>} {<-aq>} {(${ Id.VSub_Name HOST)})
                                          (C {<awk>} {(SQ <'{print $1}'>)})
                                        ]
                                        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: <Id.Left_Backtick '`'>
                                child: 
                                  (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: 
                        (condition.Shell
                          commands: [
                            (command.Sentence
                              child: 
                                (command.DBracket
                                  expr: 
                                    (bool_expr.Unary
                                      op_id: Id.BoolUnary_z
                                      child: {(DQ ($ Id.VSub_DollarName '$UP'))}
                                    )
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                        )
                      action: [
                        (C {<echo>} {(DQ <'VM is not up yet or is unreachable'>)})
                        (command.If
                          arms: [
                            (if_arm
                              cond: 
                                (condition.Shell
                                  commands: [
                                    (command.Sentence
                                      child: 
                                        (command.DBracket
                                          expr: 
                                            (bool_expr.Binary
                                              op_id: Id.BoolBinary_GlobEqual
                                              left: {($ Id.VSub_DollarName '$ATTEMPT')}
                                              right: {<G>}
                                            )
                                        )
                                      terminator: <Id.Op_Semi _>
                                    )
                                  ]
                                )
                              action: [
                                (C {<echo>} 
                                  {(DQ <'Maybe machine needs rework. Rerun this when it\'s up'>)}
                                )
                                (command.ControlFlow
                                  token: <Id.ControlFlow_Exit exit>
                                  arg_word: {<1>}
                                )
                              ]
                              spids: [381 394]
                            )
                          ]
                        )
                        (C {<sleep>} {<5>})
                      ]
                      spids: [358 371]
                    )
                  ]
                  else_action: [(command.ControlFlow token:<Id.ControlFlow_Break break>)]
                )
              ]
            )
        )
        (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: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: 
                        (command.Simple
                          words: [{<hash>} {<sshpass>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '2>'>
                              loc: (redir_loc.Fd fd:2)
                              arg: {<'/dev/null'>}
                            )
                          ]
                          do_fork: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:EDITED)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (command_sub
                            left_token: <Id.Left_Backtick '`'>
                            child: 
                              (C {<sshpass>} {<-p>} {<ubuntu>} {($ Id.VSub_DollarName '$SSHCMD')} {<-t>} 
                                {<ubuntu> <Id.Lit_At '@'> ($ 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:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
        (command.If
          arms: [
            (if_arm
              cond: 
                (condition.Shell
                  commands: [
                    (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: <Id.Op_Semi _>
                    )
                  ]
                )
              action: [
                (C {<echo>} {(DQ <'interfaces file appears adjusted already'>)})
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> 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_At '@'> ($ 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_At '@'> ($ 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_At '@'> ($ 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_At '@'> ($ Id.VSub_DollarName '$HOST')} {(DQ <'echo ubuntu | sudo -S service networking restart'>)}
            )
          ]
        )
      ]
    )
  ]
)