(command.CommandList children: [ (C {(Id.KW_Set set)} {(-o)} {(errexit)}) (C {(Id.KW_Set set)} {(-o)} {(nounset)}) (C {(Id.KW_Set set)} {(-o)} {(pipefail)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:KUBE_ROOT) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:83) command_list: (command.CommandList children: [(C {(dirname)} {(DQ (${ Id.VSub_Name BASH_SOURCE))})] ) ) (/..) } spids: [82] ) ] ) (C {(source)} {(DQ (${ Id.VSub_Name KUBE_ROOT) (/hack/lib/init.sh))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:KUBECTL) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name KUBE_OUTPUT_HOSTBIN) (/kubectl))} spids: [104] ) ] ) (C {(declare)} {(-a)} {(Id.Lit_VarLike 'resources=') (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:127) words: [ {(DQ (endpoints))} {(DQ (events))} {(DQ (limitranges))} {(DQ (namespaces))} {(DQ (nodes))} {(DQ (pods))} {(DQ (persistentvolumes))} {(DQ (persistentvolumeclaims))} {(DQ (replicationcontrollers))} {(DQ (resourcequotas))} {(DQ (secrets))} {(DQ (services))} {(DQ (jobs))} {(DQ (horizontalpodautoscalers))} {(DQ (storageclasses))} {(DQ (roles.rbac.authorization.k8s.io))} {(DQ (rolebindings.rbac.authorization.k8s.io))} {(DQ (clusterroles.rbac.authorization.k8s.io))} {(DQ (clusterrolebindings.rbac.authorization.k8s.io))} ] ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:namespaces) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:231) words: [ { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:233) command_list: (command.CommandList children: [ (C {(DQ (${ Id.VSub_Name KUBECTL))} {(get)} {(namespaces)} {(-o)} {(go-template) (Id.Lit_Equals '=') (DQ ('{{range.items}}{{.metadata.name}} {{end}}')) } ) ] ) ) } ] ) } spids: [230] ) ] ) (command.If arms: [ (if_arm cond: [ (C {(Id.Lit_LBracket '[')} {(-z)} { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:namespaces span_id:262) suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:(word.Empty)) ) ) } {(Id.Lit_RBracket ']')} ) ] action: [ (C {(echo)} {(DQ ('Unexpected: No namespace found. Nothing to do.'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:279) arg_word: {(1)} ) ] spids: [254 269] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:all_failed) op: assign_op.Equal rhs: {(1)} spids: [286] ) ] ) (command.ForEach iter_name: resource iter_words: [ { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:resources span_id:298) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.ForEach iter_name: namespace iter_words: [ { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:namespaces span_id:316) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (C {(Id.KW_Set set)} {(Id.Lit_Other '+') (e)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:instances) op: assign_op.Equal rhs: { (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:346) words: [ { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:348) command_list: (command.CommandList children: [ (C {(DQ (${ Id.VSub_Name KUBECTL))} {(get)} {(DQ (${ Id.VSub_Name resource))} {(--namespace) (Id.Lit_Equals '=') (DQ (${ Id.VSub_Name namespace))} {(-o)} {(go-template) (Id.Lit_Equals '=') (DQ ('{{range.items}}{{.metadata.name}} {{end}}')) } ) ] ) ) } ] ) } spids: [345] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:result) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [382] ) ] ) (C {(Id.KW_Set set)} {(-e)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalAnd left: (bool_expr.Binary op_id: Id.BoolBinary_eq left: {(DQ (${ Id.VSub_Name all_failed))} right: {(1)} ) right: (bool_expr.Binary op_id: Id.BoolBinary_eq left: {(DQ (${ Id.VSub_Name result))} right: {(0)} ) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:419) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:all_failed) op: assign_op.Equal rhs: {(0)} spids: [424] ) ] ) ] spids: [392 421] ) ] ) (command.If arms: [ (if_arm cond: [ (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:instances span_id:444) suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:(word.Empty)) ) ) } ) ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Continue val:continue span_id:455) ) ] spids: [436 452] ) ] ) (command.ForEach iter_name: instance iter_words: [ { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:instances span_id:469) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:success) op: assign_op.Equal rhs: {(0)} spids: [500] ) ] ) (command.ForExpr init: (arith_expr.BinaryAssign op_id: Id.Arith_Equal left: (sh_lhs_expr.Name name:tries) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) cond: (arith_expr.Binary op_id: Id.Arith_Less left: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:tries span_id:513) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 5)}) ) update: (arith_expr.UnaryAssign op_id: Id.Arith_DPlus child: (sh_lhs_expr.Name name:tries) ) body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filename) op: assign_op.Equal rhs: { (DQ (/tmp/k8s-) (${ Id.VSub_Name namespace) (-) (${ Id.VSub_Name resource) (-) (${ Id.VSub_Name instance) (.json) ) } spids: [528] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Subshell command_list: (command.CommandList children: [ (command.Simple words: [ {(DQ (${ Id.VSub_Name KUBECTL))} {(get)} {(DQ (${ Id.VSub_Name resource))} {(DQ (${ Id.VSub_Name instance))} {(--namespace) (Id.Lit_Equals '=') (DQ (${ Id.VSub_Name namespace)) } {(-o)} {(json)} ] redirects: [ (redir.Redir op: (Token id: Id.Redir_Great val: '>' span_id: 580 ) fd: -1 arg_word: {(DQ (${ Id.VSub_Name filename))} ) ] ) ] ) ) (C {(true)}) ] ) (command.If arms: [ (if_arm cond: [ (command.DBracket expr: (bool_expr.LogicalNot child: (bool_expr.Unary op_id: Id.BoolUnary_s child: {(DQ (${ Id.VSub_Name filename))} ) ) ) ] action: [ (C {(echo)} { (DQ ('Looks like ') (${ Id.VSub_Name instance) (' got deleted. Ignoring it') ) } ) (command.ControlFlow token: (Token id: Id.ControlFlow_Continue val: continue span_id: 634 ) ) ] spids: [595 612] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:output) op: assign_op.Equal rhs: { (command_sub left_token: (Token id: Id.Left_DollarParen val: '$(' span_id: 641 ) command_list: (command.CommandList children: [ (C {(DQ (${ Id.VSub_Name KUBECTL))} {(replace)} {(-f)} {(DQ (${ Id.VSub_Name filename))} {(--namespace) (Id.Lit_Equals '=') (DQ (${ Id.VSub_Name namespace)) } ) ] ) ) } spids: [640] ) ] ) (C {(true)}) ] ) (C {(rm)} {(DQ (${ Id.VSub_Name filename))}) (command.If arms: [ (if_arm cond: [ (C {(Id.Lit_LBracket '[')} {(-n)} { (DQ (braced_var_sub token: (Token id: Id.VSub_Name val: output span_id: 689 ) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: (word.Empty) ) ) ) } {(Id.Lit_RBracket ']')} ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:success) op: assign_op.Equal rhs: {(1)} spids: [700] ) ] ) (command.ControlFlow token: (Token id: Id.ControlFlow_Break val: break span_id: 704 ) ) ] spids: [681 697] ) ] ) ] ) ) (command.If arms: [ (if_arm cond: [ (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_eq left: {(DQ (${ Id.VSub_Name success))} right: {(0)} ) ) ] action: [ (C {(echo)} { (DQ ('Error: failed to update ') (${ Id.VSub_Name resource) (/) (${ Id.VSub_Name instance) (' in ') (${ Id.VSub_Name namespace) (' namespace after 5 tries') ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:752) arg_word: {(1)} ) ] spids: [713 730] ) ] ) ] ) ) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name resource))} right: {(DQ (namespaces))} ) ) (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name resource))} right: {(DQ (nodes))} ) ) ] ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:811) ) ] spids: [763 800] ) ] ) ] ) ) ] ) ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_eq left: {(DQ (${ Id.VSub_Name all_failed))} right: {(1)} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:837) ) ] action: [ (C {(echo)} {(DQ ('kubectl get failed for all resources'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:849) arg_word: {(1)} ) ] spids: [822 839] ) ] ) (C {(echo)} {(DQ ('All objects updated successfully!!'))}) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:863) arg_word:{(0)}) ] )