(command.CommandList children: [ (C {(Id.KW_Set set)} {(-e)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:33) command_list: (command.CommandList children:[(C {(pwd)})]) ) ) } right: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:41) command_list: (command.CommandList children: [(C {(git)} {(rev-parse)} {(--show-toplevel)})] ) ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:51) ) ] action: [ (command.Simple words: [ {(printf)} { (SQ (Token id: Id.Lit_Chars val: '#### WARNING: This should be run in the git top level directory! ####\\n' span_id: 59 ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:62) fd: -1 arg_word: {(/dev/stderr)} ) ] ) ] spids: [28 53] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ENVIRONMENT) op: assign_op.Equal rhs: {(Test-Laptop)} spids: [69] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:PROXY) op: assign_op.Equal rhs: {(proxy.example.com) (Id.Lit_Other ':') (80)} spids: [72] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DNS_SERVERS) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'"8.8.8.8", "8.8.4.4"' span_id:79))} spids: [77] ) ] ) (C {(export)} {(Id.Lit_VarLike 'BOOTSTRAP_VM_MEM=') (3096)}) (C {(export)} {(Id.Lit_VarLike 'BOOTSTRAP_VM_CPUs=') (2)}) (C {(export)} {(Id.Lit_VarLike 'CLUSTER_VM_MEM=') (5120)}) (C {(export)} {(Id.Lit_VarLike 'CLUSTER_VM_CPUs=') (4)}) (C {(printf)} {(DQ ('#### Setup configuration files') (Id.Lit_Other '\\') (n))}) (C {(sed)} {(-i)} {(SQ (Token id:Id.Lit_Chars val:'s/vb.gui = true/vb.gui = false/' span_id:119))} {(Vagrantfile)} ) (C {(sed)} {(-i)} { (DQ ('s/#export PROXY=.*') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:134) ) ('/export PROXY=') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:136)) ($ Id.VSub_DollarName '$PROXY') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:138)) (/) ) } {(proxy_setup.sh)} ) (C {(sed)} {(-i)} { (DQ (s/) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:154)) (dns_servers) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:156)) (' : ') (Id.Lit_Other '\\') ('[ ') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:160)) (8.8.8.8) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:162) ) (', ') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:164)) (8.8.4.4) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:166) ) (' ') (Id.Lit_Other '\\') (']/') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:170) ) (dns_servers) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:172)) (' : ') (Id.Lit_Other '\\') ('[ ') ($ Id.VSub_DollarName '$DNS_SERVERS') (' ') (Id.Lit_Other '\\') (']/') ) } {(environments/) (${ Id.VSub_Name ENVIRONMENT) (.json)} ) (C {(sed)} {(-i)} { (DQ ('s#') (Id.Lit_Other '\\') ('(') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:196) ) (bootstrap) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:198)) (': {') (Id.Lit_Other '\\') (')#') (Id.Lit_Other '\\') (1) (Id.Lit_Other '\\') (n) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:206) ) (proxy) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:208)) (' : ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:210) ) ('http://') ($ Id.VSub_DollarName '$PROXY') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:213) ) (',') (Id.Lit_Other '\\') ('n#') ) } {(environments/) (${ Id.VSub_Name ENVIRONMENT) (.json)} ) (C {(printf)} {(DQ ("#### Setup VB's and Bootstrap") (Id.Lit_Other '\\') (n))}) (C {(source)} {(./vbox_create.sh)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(download_VM_files)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(echo)} { (DQ ('############## VBOX DOWNLOAD VM FILES RETURNED ') ($ Id.VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:255) arg_word: {(1)} ) ] ) ] ) ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(create_bootstrap_VM)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(echo)} { (DQ ('############## VBOX CREATE BOOTSTRAP VM RETURNED ') ($ Id.VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:277) arg_word: {(1)} ) ] ) ] ) ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(create_cluster_VMs)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(echo)} { (DQ ('############## VBOX CREATE CLUSTER VMs RETURNED ') ($ Id.VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:299) arg_word: {(1)} ) ] ) ] ) ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(install_cluster)}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(echo)} { (DQ ('############## bootstrap_chef.sh returned ') ($ Id.VSub_QMark '$?') (' ##############') ) } ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:321) arg_word: {(1)} ) ] ) ] ) ) ] ) (C {(printf)} {(DQ ('#### Cobbler Boot') (Id.Lit_Other '\\') (n))}) (C {(printf)} {(DQ ('Snapshotting pre-Cobbler and booting (unless already running)') (Id.Lit_Other '\\') (n))} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:vms_started) op: assign_op.Equal rhs: {(DQ (False))} spids: [344] ) ] ) (command.ForEach iter_name: i iter_words: [{(1)} {(2)} {(3)}] do_arg_iter: F body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Pipeline children: [ (C {(vboxmanage)} {(showvminfo)} {(bcpc-vm) ($ Id.VSub_DollarName '$i')}) (C {(grep)} {(-q)} {(SQ (Token id:Id.Lit_Chars val:'^State:.*running' span_id:379))}) ] negated: F ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:vms_started) op: assign_op.Equal rhs: {(DQ (True))} spids: [384] ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Pipeline children: [ (C {(vboxmanage)} {(showvminfo)} {(bcpc-vm) ($ Id.VSub_DollarName '$i')}) (C {(grep)} {(-q)} {(SQ (Token id:Id.Lit_Chars val:'^State:.*running' span_id:404))}) ] negated: F ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm) ($ Id.VSub_DollarName '$i')} {(take)} {(Shoe-less)} ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Pipeline children: [ (C {(vboxmanage)} {(showvminfo)} {(bcpc-vm) ($ Id.VSub_DollarName '$i')}) (C {(grep)} {(-q)} {(SQ (Token id:Id.Lit_Chars val:'^State:.*running' span_id:435))}) ] negated: F ) (C {(VBoxManage)} {(startvm)} {(bcpc-vm) ($ Id.VSub_DollarName '$i')} {(--type)} {(headless)} ) ] ) ] ) ) (C {(printf)} {(DQ ('Checking VMs are up: ') (Id.Lit_Other '\\') (n))}) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:462) cond: [ (command.AndOr ops: [Id.Op_DPipe Id.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: [Id.Op_DPipe] children: [ (command.Simple words: [ {(nc)} {(-w)} {(1)} {(-q)} {(0)} {(10.0.100.) ($ Id.VSub_DollarName '$m')} {(22)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:566) fd: -1 arg_word: {(/dev/null)} ) ] ) (C {(echo)} {(-n)} {(DQ (10.0.100.) ($ Id.VSub_DollarName '$m') (' '))}) ] ) ] ) ) (C {(printf)} {(DQ (Id.Lit_Other '\\') (n))}) ] ) ) (C {(printf)} {(DQ ('Snapshotting post-Cobbler') (Id.Lit_Other '\\') (n))}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_DollarName '$vms_started'))} right: {(DQ (True))} ) ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm1)} {(take)} {(Post-Cobble)}) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_DollarName '$vms_started'))} right: {(DQ (True))} ) ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm2)} {(take)} {(Post-Cobble)}) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_DollarName '$vms_started'))} right: {(DQ (True))} ) ) (C {(VBoxManage)} {(snapshot)} {(bcpc-vm3)} {(take)} {(Post-Cobble)}) ] ) (C {(printf)} {(DQ ('#### Chef all the nodes') (Id.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: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:703) command_list: (command.CommandList children: [ (C {(vagrant)} {(ssh)} {(-c)} { (DQ ('cd chef-bcpc; knife data bag show configs ') ($ Id.VSub_DollarName '$ENVIRONMENT') (" | grep 'cobbler-root-password:'|sed 's/.* //'") ) } ) ] ) ) } spids: [702] ) ] ) (C {(printf)} {(DQ ('#### Chef the first headnode(s)') (Id.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 ') ($ Id.VSub_DollarName '$ENVIRONMENT') (' bcpc-vm1') ) } ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:741) ) ] action: [ (C {(printf)} {(DQ ('## set the first machine to admin') (Id.Lit_Other '\\') (n))}) (C {(vagrant)} {(ssh)} {(-c)} { (SQ (Token id: Id.Lit_Chars val: 'cd chef-bcpc; echo -e "/\\"admin\\": false\\ns/false/true\\nw\\nq\\n" | EDITOR=ed knife client edit `knife client list | grep bcpc-vm1`' span_id: 763 ) ) } ) (C {(vagrant)} {(ssh)} {(-c)} { (DQ ('cd chef-bcpc; echo ') ($ Id.VSub_DollarName '$cobbler_pass') (' | sudo knife bootstrap -E ') ($ Id.VSub_DollarName '$ENVIRONMENT') (" -r 'role[BCPC-Headnode]' 10.0.100.11 -x ubuntu --sudo") ) } ) ] spids: [726 743] ) ] ) (command.ForEach iter_name: i iter_words: [{(2)} {(3)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(printf)} {(DQ ('## Machine bcpc-vm') (${ Id.VSub_Name i) (Id.Lit_Other '\\') (n))}) (C {(vagrant)} {(ssh)} {(-c)} { (DQ ('cd chef-bcpc; ./cluster-assign-roles.sh ') ($ Id.VSub_DollarName '$ENVIRONMENT') (' bcpc-vm') ($ Id.VSub_DollarName '$i') ) } ) ] ) ) (C {(printf)} {(DQ ('Snapshotting post-Cobbler') (Id.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)}) ] )