(CommandList
  children: [
    (C {(set)} {(-o)} {(errexit)})
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:KUBE_ROOT)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (C {(dirname)} 
                        {
                          (DQ 
                            (BracedVarSub
                              token: <VSub_Name BASH_SOURCE>
                              bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)}))
                              spids: [147 152]
                            )
                          )
                        }
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [143 154]
              ) (/../..)
            }
          spids: [142]
        )
      ]
      spids: [142]
    )
    (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/photon-controller/util.sh))})
    (FuncDef
      name: main
      body: 
        (BraceGroup
          children: [
            (C {(verify-cmd-in-path)} {(photon)})
            (C {(set-target)})
            (C {(create-tenant)})
            (C {(create-project)})
            (C {(create-vm-flavor)} {(DQ (${ VSub_Name PHOTON_MASTER_FLAVOR))} 
              {(DQ (${ VSub_Name SETUP_MASTER_FLAVOR_SPEC))}
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other "[")} {(DQ (${ VSub_Name PHOTON_MASTER_FLAVOR))} 
                          {(KW_Bang "!") (Lit_Other "=")} {(DQ (${ VSub_Name PHOTON_NODE_FLAVOR))} {(Lit_Other "]")}
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(create-vm-flavor)} {(DQ (${ VSub_Name PHOTON_NODE_FLAVOR))} 
                      {(DQ (${ VSub_Name SETUP_NODE_FLAVOR_SPEC))}
                    )
                  ]
                  spids: [-1 228]
                )
              ]
              spids: [-1 246]
            )
            (C {(create-disk-flavor)})
            (C {(create-image)})
          ]
          spids: [174]
        )
      spids: [170 173]
    )
    (FuncDef
      name: parse-cmd-line
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:PHOTON_TARGET)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ )})
                        spids: [265 270]
                      )
                    }
                  spids: [264]
                )
              ]
              spids: [264]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:PHOTON_VMDK)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Number 2>
                        suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ )})
                        spids: [274 279]
                      )
                    }
                  spids: [273]
                )
              ]
              spids: [273]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (LogicalOr
                              left: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobEqual
                                  left: {(DQ (${ VSub_Name PHOTON_TARGET))}
                                  right: {(DQ )}
                                )
                              right: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobEqual
                                  left: {(DQ (${ VSub_Name PHOTON_VMDK))}
                                  right: {(DQ )}
                                )
                            )
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ ("Usage: setup-prereq <photon target> <path-to-kube-vmdk>"))})
                    (C {(echo)} {(DQ ("Target should be a URL like https://192.0.2.1"))})
                    (C {(echo)} {(DQ )})
                    (C {(echo)} 
                      {
                        (DQ 
                          (
"This will create the following, based on the configuration in config-common.sh"
                          )
                        )
                      }
                    )
                    (C {(echo)} {(DQ ("    * A tenant named ") (${ VSub_Name PHOTON_TENANT))})
                    (C {(echo)} {(DQ ("    * A project named ") (${ VSub_Name PHOTON_PROJECT))})
                    (C {(echo)} {(DQ ("    * A VM flavor named ") (${ VSub_Name PHOTON_MASTER_FLAVOR))})
                    (C {(echo)} {(DQ ("    * A disk flavor named ") (${ VSub_Name PHOTON_DISK_FLAVOR))})
                    (C {(echo)} {(DQ ("It will also upload the Kube VMDK"))})
                    (C {(echo)} {(DQ )})
                    (C {(echo)} {(DQ ("It creates the tenant with a resource ticket (quota) that may"))})
                    (C {(echo)} {(DQ ("be inappropriate for your environment. For a production"))})
                    (C {(echo)} {(DQ ("environment, you should configure these to match your"))})
                    (C {(echo)} {(DQ (environment.))})
                    (C {(exit)} {(1)})
                  ]
                  spids: [-1 314]
                )
              ]
              spids: [-1 430]
            )
            (C {(echo)} {(DQ ("Photon Target: ") (${ VSub_Name PHOTON_TARGET))})
            (C {(echo)} {(DQ ("Photon VMDK: ") (${ VSub_Name PHOTON_VMDK))})
          ]
          spids: [261]
        )
      spids: [257 260]
    )
    (FuncDef
      name: set-target
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(${ VSub_Name PHOTON)} {(target)} {(set)} {(DQ (${ VSub_Name PHOTON_TARGET))}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[477])
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[481])
              ]
            )
          ]
          spids: [460]
        )
      spids: [456 459]
    )
    (FuncDef
      name: create-tenant
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[496])]
              spids: [494]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:output) op:Equal spids:[502])]
              spids: [500]
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(${ VSub_Name PHOTON)} {(tenant)} {(list)})
                    (SimpleCommand
                      words: [
                        {(grep)}
                        {(-q)}
                        {
                          (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                            (${ VSub_Name PHOTON_TENANT) (Lit_Other "$")
                          )
                        }
                      ]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [528]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [532]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:rc)
                      op: Equal
                      rhs: {($ VSub_QMark "$?")}
                      spids: [537]
                    )
                  ]
                  spids: [537]
                )
              ]
              op_id: Op_DPipe
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{(${ VSub_Name rc)} right:{(0)})
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {(DQ ("Tenant ") (${ VSub_Name PHOTON_TENANT) (" already made, skipping"))}
                    )
                  ]
                  spids: [-1 556]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("Making tenant ") (${ VSub_Name PHOTON_TENANT))})
                (Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[583])]
                  spids: [583]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:output)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [
                                          {(${ VSub_Name PHOTON)}
                                          {(tenant)}
                                          {(create)}
                                          {(DQ (${ VSub_Name PHOTON_TENANT))}
                                        ]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [603]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [588 605]
                              )
                            }
                          spids: [587]
                        )
                      ]
                      spids: [587]
                    )
                    (BraceGroup
                      children: [
                        (C {(echo)} 
                          {
                            (DQ ("ERROR: Could not create tenant ") 
                              (EscapedLiteralPart
                                token: <Lit_EscapedChar "\\\"">
                              ) (${ VSub_Name PHOTON_TENANT) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (", exiting")
                            )
                          }
                        )
                        (C {(echo)} {(DQ ("Output from tenant creation:"))})
                        (C {(echo)} {(DQ (${ VSub_Name output))})
                        (C {(exit)} {(1)})
                      ]
                      spids: [609]
                    )
                  ]
                  op_id: Op_DPipe
                )
              ]
              spids: [570 649]
            )
            (SimpleCommand
              words: [{(${ VSub_Name PHOTON)} {(tenant)} {(set)} {(DQ (${ VSub_Name PHOTON_TENANT))}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[666])
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[670])
              ]
            )
          ]
          spids: [491]
        )
      spids: [487 490]
    )
    (FuncDef
      name: create-project
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[685])]
              spids: [683]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:output) op:Equal spids:[691])]
              spids: [689]
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(${ VSub_Name PHOTON)} {(project)} {(list)})
                    (SimpleCommand
                      words: [
                        {(grep)}
                        {(-q)}
                        {
                          (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                            (${ VSub_Name PHOTON_PROJECT) (EscapedLiteralPart token:<Lit_EscapedChar "\\t">)
                          )
                        }
                      ]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [717]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [721]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:rc)
                      op: Equal
                      rhs: {($ VSub_QMark "$?")}
                      spids: [726]
                    )
                  ]
                  spids: [726]
                )
              ]
              op_id: Op_DPipe
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{(${ VSub_Name rc)} right:{(0)})
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {(DQ ("Project ") (${ VSub_Name PHOTON_PROJECT) (" already made, skipping"))}
                    )
                  ]
                  spids: [-1 745]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("Making project ") (${ VSub_Name PHOTON_PROJECT))})
                (Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[772])]
                  spids: [772]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:output)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [
                                          {(${ VSub_Name PHOTON)}
                                          {(resource-ticket)}
                                          {(create)}
                                          {(--tenant)}
                                          {(DQ (${ VSub_Name PHOTON_TENANT))}
                                          {(--name)}
                                          {(DQ (${ VSub_Name PHOTON_TENANT) (-resources))}
                                          {(--limits)}
                                          {(DQ (${ VSub_Name SETUP_TICKET_SPEC))}
                                        ]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [811]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [777 813]
                              )
                            }
                          spids: [776]
                        )
                      ]
                      spids: [776]
                    )
                    (BraceGroup
                      children: [
                        (C {(echo)} {(DQ ("ERROR: Could not create resource ticket, exiting"))})
                        (C {(echo)} {(DQ ("Output from resource ticket creation:"))})
                        (C {(echo)} {(DQ (${ VSub_Name output))})
                        (C {(exit)} {(1)})
                      ]
                      spids: [817]
                    )
                  ]
                  op_id: Op_DPipe
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[852])]
                  spids: [852]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:output)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [
                                          {(${ VSub_Name PHOTON)}
                                          {(project)}
                                          {(create)}
                                          {(--tenant)}
                                          {(DQ (${ VSub_Name PHOTON_TENANT))}
                                          {(--resource-ticket)}
                                          {(DQ (${ VSub_Name PHOTON_TENANT) (-resources))}
                                          {(--name)}
                                          {(DQ (${ VSub_Name PHOTON_PROJECT))}
                                          {(--limits)}
                                          {(DQ (${ VSub_Name SETUP_PROJECT_SPEC))}
                                        ]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [899]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [857 901]
                              )
                            }
                          spids: [856]
                        )
                      ]
                      spids: [856]
                    )
                    (BraceGroup
                      children: [
                        (C {(echo)} 
                          {
                            (DQ ("ERROR: Could not create project ") 
                              (EscapedLiteralPart
                                token: <Lit_EscapedChar "\\\"">
                              ) (${ VSub_Name PHOTON_PROJECT) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (", exiting")
                            )
                          }
                        )
                        (C {(echo)} {(DQ ("Output from project creation:"))})
                        (C {(echo)} {(DQ (${ VSub_Name output))})
                        (C {(exit)} {(1)})
                      ]
                      spids: [905]
                    )
                  ]
                  op_id: Op_DPipe
                )
              ]
              spids: [759 945]
            )
            (C {(${ VSub_Name PHOTON)} {(project)} {(set)} {(DQ (${ VSub_Name PHOTON_PROJECT))})
          ]
          spids: [680]
        )
      spids: [676 679]
    )
    (FuncDef
      name: create-vm-flavor
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:flavor_name)
                  op: Equal
                  rhs: {(${ VSub_Number 1)}
                  spids: [974]
                )
              ]
              spids: [972]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:flavor_spec)
                  op: Equal
                  rhs: {(${ VSub_Number 2)}
                  spids: [982]
                )
              ]
              spids: [980]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[990])]
              spids: [988]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:output) op:Equal spids:[996])]
              spids: [994]
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(${ VSub_Name PHOTON)} {(flavor)} {(list)})
                    (SimpleCommand
                      words: [
                        {(grep)}
                        {(-q)}
                        {
                          (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                            (${ VSub_Name flavor_name) (EscapedLiteralPart token:<Lit_EscapedChar "\\t">)
                          )
                        }
                      ]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [1022]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [1026]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:rc)
                      op: Equal
                      rhs: {($ VSub_QMark "$?")}
                      spids: [1031]
                    )
                  ]
                  spids: [1031]
                )
              ]
              op_id: Op_DPipe
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{(${ VSub_Name rc)} right:{(0)})
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(check-flavor-ready)} {(DQ (${ VSub_Name flavor_name))})
                    (C {(echo)} 
                      {(DQ ("Flavor ") (${ VSub_Name flavor_name) (" already made, skipping"))}
                    )
                  ]
                  spids: [-1 1050]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("Making VM flavor ") (${ VSub_Name flavor_name))})
                (Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[1086])]
                  spids: [1086]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:output)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [
                                          {(${ VSub_Name PHOTON)}
                                          {(-n)}
                                          {(flavor)}
                                          {(create)}
                                          {(--name)}
                                          {(DQ (${ VSub_Name flavor_name))}
                                          {(--kind)}
                                          {(DQ (vm))}
                                          {(--cost)}
                                          {(DQ (${ VSub_Name flavor_spec))}
                                        ]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [1124]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [1091 1126]
                              )
                            }
                          spids: [1090]
                        )
                      ]
                      spids: [1090]
                    )
                    (BraceGroup
                      children: [
                        (C {(echo)} 
                          {
                            (DQ ("ERROR: Could not create vm flavor ") 
                              (EscapedLiteralPart
                                token: <Lit_EscapedChar "\\\"">
                              ) (${ VSub_Name flavor_name) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (", exiting")
                            )
                          }
                        )
                        (C {(echo)} {(DQ ("Output from flavor creation:"))})
                        (C {(echo)} {(DQ (${ VSub_Name output))})
                        (C {(exit)} {(1)})
                      ]
                      spids: [1130]
                    )
                  ]
                  op_id: Op_DPipe
                )
              ]
              spids: [1073 1170]
            )
          ]
          spids: [969]
        )
      spids: [965 968]
    )
    (FuncDef
      name: create-disk-flavor
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[1184])]
              spids: [1182]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:output) op:Equal spids:[1190])]
              spids: [1188]
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(${ VSub_Name PHOTON)} {(flavor)} {(list)})
                    (SimpleCommand
                      words: [
                        {(grep)}
                        {(-q)}
                        {
                          (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                            (${ VSub_Name PHOTON_DISK_FLAVOR) (EscapedLiteralPart token:<Lit_EscapedChar "\\t">)
                          )
                        }
                      ]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [1216]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [1220]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:rc)
                      op: Equal
                      rhs: {($ VSub_QMark "$?")}
                      spids: [1225]
                    )
                  ]
                  spids: [1225]
                )
              ]
              op_id: Op_DPipe
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{(${ VSub_Name rc)} right:{(0)})
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(check-flavor-ready)} {(DQ (${ VSub_Name PHOTON_DISK_FLAVOR))})
                    (C {(echo)} 
                      {
                        (DQ ("Flavor ") (${ VSub_Name PHOTON_DISK_FLAVOR) (" already made, skipping"))
                      }
                    )
                  ]
                  spids: [-1 1244]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("Making disk flavor ") (${ VSub_Name PHOTON_DISK_FLAVOR))})
                (Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[1280])]
                  spids: [1280]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:output)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [
                                          {(${ VSub_Name PHOTON)}
                                          {(-n)}
                                          {(flavor)}
                                          {(create)}
                                          {(--name)}
                                          {(DQ (${ VSub_Name PHOTON_DISK_FLAVOR))}
                                          {(--kind)}
                                          {(DQ (ephemeral-disk))}
                                          {(--cost)}
                                          {(DQ (${ VSub_Name SETUP_DISK_FLAVOR_SPEC))}
                                        ]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [1318]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [1285 1320]
                              )
                            }
                          spids: [1284]
                        )
                      ]
                      spids: [1284]
                    )
                    (BraceGroup
                      children: [
                        (C {(echo)} 
                          {
                            (DQ ("ERROR: Could not create disk flavor ") 
                              (EscapedLiteralPart
                                token: <Lit_EscapedChar "\\\"">
                              ) (${ VSub_Name PHOTON_DISK_FLAVOR) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (", exiting")
                            )
                          }
                        )
                        (C {(echo)} {(DQ ("Output from flavor creation:"))})
                        (C {(echo)} {(DQ (${ VSub_Name output))})
                        (C {(exit)} {(1)})
                      ]
                      spids: [1324]
                    )
                  ]
                  op_id: Op_DPipe
                )
              ]
              spids: [1267 1364]
            )
          ]
          spids: [1179]
        )
      spids: [1175 1178]
    )
    (FuncDef
      name: check-flavor-ready
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:flavor_name)
                  op: Equal
                  rhs: {(${ VSub_Number 1)}
                  spids: [1378]
                )
              ]
              spids: [1376]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[1386])]
              spids: [1384]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:flavor_id) op:Equal spids:[1393])]
              spids: [1391]
            )
            (AndOr
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:flavor_id)
                      op: Equal
                      rhs: 
                        {
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (Pipeline
                                    children: [
                                      (C {(${ VSub_Name PHOTON)} {(flavor)} {(list)})
                                      (C {(grep)} 
                                        {
                                          (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                                            (${ VSub_Name flavor_name) (EscapedLiteralPart token:<Lit_EscapedChar "\\t">)
                                          )
                                        }
                                      )
                                      (C {(awk)} {(SQ <"{print $1}">)})
                                    ]
                                    negated: False
                                  )
                                ]
                              )
                            left_token: <Left_CommandSub "$(">
                            spids: [1397 1425]
                          )
                        }
                      spids: [1396]
                    )
                  ]
                  spids: [1396]
                )
                (BraceGroup
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ("ERROR: Found ") (${ VSub_Name flavor_name) (" but cannot find it's id"))
                      }
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [1429]
                )
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(${ VSub_Name PHOTON)} {(flavor)} {(show)} {(DQ (${ VSub_Name flavor_id))})
                    (SimpleCommand
                      words: [
                        {(grep)}
                        {
                          (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) (READY) 
                            (EscapedLiteralPart
                              token: <Lit_EscapedChar "\\$">
                            )
                          )
                        }
                      ]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [1476]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [1480]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (BraceGroup
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ("ERROR: Flavor ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) 
                          (${ VSub_Name flavor_name) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) 
                          (" already exists but is not READY. Please delete or fix it.")
                        )
                      }
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [1485]
                )
              ]
              op_id: Op_DPipe
            )
          ]
          spids: [1373]
        )
      spids: [1369 1372]
    )
    (FuncDef
      name: create-image
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[1520])]
              spids: [1518]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:num_images) op:Equal spids:[1526])]
              spids: [1524]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:output) op:Equal spids:[1531])]
              spids: [1529]
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(${ VSub_Name PHOTON)} {(image)} {(list)})
                    (C {(grep)} 
                      {
                        (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                          (${ VSub_Name PHOTON_IMAGE) (EscapedLiteralPart token:<Lit_EscapedChar "\\t">)
                        )
                      }
                    )
                    (SimpleCommand
                      words: [{(grep)} {(-q)} {(ERROR)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [1563]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [1567]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:rc)
                      op: Equal
                      rhs: {($ VSub_QMark "$?")}
                      spids: [1572]
                    )
                  ]
                  spids: [1572]
                )
              ]
              op_id: Op_DPipe
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{(${ VSub_Name rc)} right:{(0)})
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ("Warning: You have at least one ") (${ VSub_Name PHOTON_IMAGE) 
                          (" image in the ERROR state. You may want to investigate.")
                        )
                      }
                    )
                    (C {(echo)} {(DQ ("Images in the ERROR state will be ignored."))})
                  ]
                  spids: [-1 1591]
                )
              ]
              spids: [-1 1612]
            )
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[1616])]
              spids: [1616]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:num_images)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(${ VSub_Name PHOTON)} {(image)} {(list)})
                                  (C {(grep)} 
                                    {
                                      (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                                        (${ VSub_Name PHOTON_IMAGE) (EscapedLiteralPart token:<Lit_EscapedChar "\\t">)
                                      )
                                    }
                                  )
                                  (C {(grep)} {(READY)})
                                  (C {(wc)} {(-l)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [1629 1661]
                      )
                    }
                  spids: [1628]
                )
              ]
              spids: [1628]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_gt
                              left: {(DQ (${ VSub_Name num_images))}
                              right: {(1)}
                            )
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ("Warning: You have more than one good ") (${ VSub_Name PHOTON_IMAGE) 
                          (" image. You may want to remove duplicates.")
                        )
                      }
                    )
                  ]
                  spids: [-1 1681]
                )
              ]
              spids: [-1 1695]
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(${ VSub_Name PHOTON)} {(image)} {(list)})
                    (C {(grep)} 
                      {
                        (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) 
                          (${ VSub_Name PHOTON_IMAGE) (EscapedLiteralPart token:<Lit_EscapedChar "\\t">)
                        )
                      }
                    )
                    (SimpleCommand
                      words: [{(grep)} {(-q)} {(READY)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [1727]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [1731]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:rc)
                      op: Equal
                      rhs: {($ VSub_QMark "$?")}
                      spids: [1736]
                    )
                  ]
                  spids: [1736]
                )
              ]
              op_id: Op_DPipe
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{(${ VSub_Name rc)} right:{(0)})
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {(DQ ("Image ") (${ VSub_Name PHOTON_VMDK) (" already uploaded, skipping"))}
                    )
                  ]
                  spids: [-1 1755]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("Uploading image ") (${ VSub_Name PHOTON_VMDK))})
                (Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(0)} spids:[1782])]
                  spids: [1782]
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:output)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [
                                          {(${ VSub_Name PHOTON)}
                                          {(image)}
                                          {(create)}
                                          {(DQ (${ VSub_Name PHOTON_VMDK))}
                                          {(-n)}
                                          {(DQ (${ VSub_Name PHOTON_IMAGE))}
                                          {(-i)}
                                          {(EAGER)}
                                        ]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_GreatAnd
                                            fd: 2
                                            arg_word: {(1)}
                                            spids: [1814]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [1787 1816]
                              )
                            }
                          spids: [1786]
                        )
                      ]
                      spids: [1786]
                    )
                    (BraceGroup
                      children: [
                        (C {(echo)} {(DQ ("ERROR: Could not upload image, exiting"))})
                        (C {(echo)} {(DQ ("Output from image create:"))})
                        (C {(echo)} {(DQ (${ VSub_Name output))})
                        (C {(exit)} {(1)})
                      ]
                      spids: [1820]
                    )
                  ]
                  op_id: Op_DPipe
                )
              ]
              spids: [1769 1854]
            )
          ]
          spids: [1515]
        )
      spids: [1511 1514]
    )
    (C {(set)} {(Lit_Other "+") (o)} {(pipefail)})
    (C {(parse-cmd-line)} {(DQ ($ VSub_At "$@"))})
    (C {(main)})
  ]
)