(command.CommandList children: [ (C {(KW_Set set)} {(-e)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: BoolBinary_GlobNEqual left: { (DQ (command_sub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children:[(C {(pwd)})]) ) ) } right: { (DQ (command_sub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [(C {(git)} {(rev-parse)} {(--show-toplevel)})] ) ) ) } ) ) terminator: <Op_Semi ';'> ) ] action: [ (command.Simple words: [ {(printf)} {(SQ <'#### WARNING: This should be run in the git top level directory! ####\\n'>)} ] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/stderr)})] ) ] ) ] ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:ENVIRONMENT) op:Equal rhs:{(Test-Laptop)})] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:PROXY) op: Equal rhs: {(proxy.example.com) (Lit_Other ':') (80)} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DNS_SERVERS) op: Equal rhs: {(SQ <'"8.8.8.8", "8.8.4.4"'>)} ) ] ) (C {(export)} {(Lit_VarLike 'BOOTSTRAP_VM_MEM=') (3096)}) (C {(export)} {(Lit_VarLike 'BOOTSTRAP_VM_CPUs=') (2)}) (C {(export)} {(Lit_VarLike 'CLUSTER_VM_MEM=') (5120)}) (C {(export)} {(Lit_VarLike 'CLUSTER_VM_CPUs=') (4)}) (C {(printf)} {(DQ ('#### Setup configuration files') (Lit_Other '\\') (n))}) (C {(sed)} {(-i)} {(SQ <'s/vb.gui = true/vb.gui = false/'>)} {(Vagrantfile)}) (C {(sed)} {(-i)} { (DQ ('s/#export PROXY=.*') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) ('/export PROXY=') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) ($ VSub_DollarName '$PROXY') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (/) ) } {(proxy_setup.sh)} ) (C {(sed)} {(-i)} { (DQ (s/) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (dns_servers) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (' : ') (Lit_Other '\\') ('[ ') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (8.8.8.8) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (', ') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (8.8.4.4) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (' ') (Lit_Other '\\') (']/') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (dns_servers) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (' : ') (Lit_Other '\\') ('[ ') ($ VSub_DollarName '$DNS_SERVERS') (' ') (Lit_Other '\\') (']/') ) } {(environments/) (${ VSub_Name ENVIRONMENT) (.json)} ) (C {(sed)} {(-i)} { (DQ ('s#') (Lit_Other '\\') ('(') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (bootstrap) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (': {') (Lit_Other '\\') (')#') (Lit_Other '\\') (1) (Lit_Other '\\') (n) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (proxy) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (' : ') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) ('http://') ($ VSub_DollarName '$PROXY') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (',') (Lit_Other '\\') ('n#') ) } {(environments/) (${ VSub_Name ENVIRONMENT) (.json)} ) (C {(printf)} {(DQ ("#### Setup VB's and Bootstrap") (Lit_Other '\\') (n))}) (C {(source)} {(./vbox_create.sh)}) (command.AndOr ops: [Op_DPipe] children: [ (C {(download_VM_files)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(echo)} { (DQ ('############## VBOX DOWNLOAD VM FILES RETURNED ') ($ VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] ) ] ) ) ] ) (command.AndOr ops: [Op_DPipe] children: [ (C {(create_bootstrap_VM)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(echo)} { (DQ ('############## VBOX CREATE BOOTSTRAP VM RETURNED ') ($ VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] ) ] ) ) ] ) (command.AndOr ops: [Op_DPipe] children: [ (C {(create_cluster_VMs)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(echo)} { (DQ ('############## VBOX CREATE CLUSTER VMs RETURNED ') ($ VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] ) ] ) ) ] ) (command.AndOr ops: [Op_DPipe] children: [ (C {(install_cluster)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(echo)} { (DQ ('############## bootstrap_chef.sh returned ') ($ VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] ) ] ) ) ] ) (C {(printf)} {(DQ ('#### Cobbler Boot') (Lit_Other '\\') (n))}) (C {(printf)} {(DQ ('Snapshotting pre-Cobbler and booting (unless already running)') (Lit_Other '\\') (n))} ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:vms_started) op:Equal rhs:{(DQ (False))})] ) (command.ForEach iter_name: i iter_words: [{(1)} {(2)} {(3)}] do_arg_iter: F body: (command.DoGroup children: [ (command.AndOr ops: [Op_DPipe] children: [ (command.Pipeline children: [ (C {(vboxmanage)} {(showvminfo)} {(bcpc-vm) ($ VSub_DollarName '$i')}) (C {(grep)} {(-q)} {(SQ <'^State:.*running'>)}) ] negated: F ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:vms_started) op: Equal rhs: {(DQ (True))} ) ] ) ] ) (command.AndOr ops: [Op_DPipe] children: [ (command.Pipeline children: [ (C {(vboxmanage)} {(showvminfo)} {(bcpc-vm) ($ VSub_DollarName '$i')}) (C {(grep)} {(-q)} {(SQ <'^State:.*running'>)}) ] negated: F ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm) ($ VSub_DollarName '$i')} {(take)} {(Shoe-less)}) ] ) (command.AndOr ops: [Op_DPipe] children: [ (command.Pipeline children: [ (C {(vboxmanage)} {(showvminfo)} {(bcpc-vm) ($ VSub_DollarName '$i')}) (C {(grep)} {(-q)} {(SQ <'^State:.*running'>)}) ] negated: F ) (C {(VBoxManage)} {(startvm)} {(bcpc-vm) ($ VSub_DollarName '$i')} {(--type)} {(headless)}) ] ) ] ) ) (C {(printf)} {(DQ ('Checking VMs are up: ') (Lit_Other '\\') (n))}) (command.WhileUntil keyword: <KW_While while> cond: [ (command.AndOr ops: [Op_DPipe Op_DPipe] children: [ (command.Pipeline children: [(C {(nc)} {(-w)} {(1)} {(-q)} {(0)} {(10.0.100.11)} {(22)})] negated: T ) (command.Pipeline children: [(C {(nc)} {(-w)} {(1)} {(-q)} {(0)} {(10.0.100.12)} {(22)})] negated: T ) (command.Pipeline children: [(C {(nc)} {(-w)} {(1)} {(-q)} {(0)} {(10.0.100.13)} {(22)})] negated: T ) ] ) ] body: (command.DoGroup children: [ (C {(sleep)} {(60)}) (C {(printf)} {(DQ ('Hosts down: '))}) (command.ForEach iter_name: m iter_words: [{(11)} {(12)} {(13)}] do_arg_iter: F body: (command.DoGroup children: [ (command.AndOr ops: [Op_DPipe] children: [ (command.Simple words: [ {(nc)} {(-w)} {(1)} {(-q)} {(0)} {(10.0.100.) ($ VSub_DollarName '$m')} {(22)} ] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(/dev/null)} ) ] ) (C {(echo)} {(-n)} {(DQ (10.0.100.) ($ VSub_DollarName '$m') (' '))}) ] ) ] ) ) (C {(printf)} {(DQ (Lit_Other '\\') (n))}) ] ) ) (C {(printf)} {(DQ ('Snapshotting post-Cobbler') (Lit_Other '\\') (n))}) (command.AndOr ops: [Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Binary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_DollarName '$vms_started'))} right: {(DQ (True))} ) ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm1)} {(take)} {(Post-Cobble)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Binary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_DollarName '$vms_started'))} right: {(DQ (True))} ) ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm2)} {(take)} {(Post-Cobble)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Binary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_DollarName '$vms_started'))} right: {(DQ (True))} ) ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm3)} {(take)} {(Post-Cobble)}) ] ) (C {(printf)} {(DQ ('#### Chef all the nodes') (Lit_Other '\\') (n))}) (C {(vagrant)} {(ssh)} {(-c)} {(DQ ('sudo apt-get install -y sshpass'))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:cobbler_pass) op: Equal rhs: { (command_sub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {(vagrant)} {(ssh)} {(-c)} { (DQ ('cd chef-bcpc; knife data bag show configs ') ($ VSub_DollarName '$ENVIRONMENT') (" | grep 'cobbler-root-password:'|sed 's/.* //'") ) } ) ] ) ) } ) ] ) (C {(printf)} {(DQ ('#### Chef the first headnode(s)') (Lit_Other '\\') (n))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (C {(vagrant)} {(ssh)} {(-c)} { (DQ ('cd chef-bcpc; ./cluster-assign-roles.sh ') ($ VSub_DollarName '$ENVIRONMENT') (' bcpc-vm1') ) } ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(printf)} {(DQ ('## set the first machine to admin') (Lit_Other '\\') (n))}) (C {(vagrant)} {(ssh)} {(-c)} { (SQ < 'cd chef-bcpc; echo -e "/\\"admin\\": false\\ns/false/true\\nw\\nq\\n" | EDITOR=ed knife client edit `knife client list | grep bcpc-vm1`' > ) } ) (C {(vagrant)} {(ssh)} {(-c)} { (DQ ('cd chef-bcpc; echo ') ($ VSub_DollarName '$cobbler_pass') (' | sudo knife bootstrap -E ') ($ VSub_DollarName '$ENVIRONMENT') (" -r 'role[BCPC-Headnode]' 10.0.100.11 -x ubuntu --sudo") ) } ) ] ) ] ) (command.ForEach iter_name: i iter_words: [{(2)} {(3)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(printf)} {(DQ ('## Machine bcpc-vm') (${ VSub_Name i) (Lit_Other '\\') (n))}) (C {(vagrant)} {(ssh)} {(-c)} { (DQ ('cd chef-bcpc; ./cluster-assign-roles.sh ') ($ VSub_DollarName '$ENVIRONMENT') (' bcpc-vm') ($ VSub_DollarName '$i') ) } ) ] ) ) (C {(printf)} {(DQ ('Snapshotting post-Cobbler') (Lit_Other '\\') (n))}) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm1)} {(take)} {(Full-Shoes)}) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm2)} {(take)} {(Full-Shoes)}) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm3)} {(take)} {(Full-Shoes)}) ] )