diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-09-28 00:07:00 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-09-28 00:07:00 -0300 |
commit | 77296b33f8394b30dceba39ab995a1a449aed271 (patch) | |
tree | 3dafdc54b638278c933fa7e359646aeb5929d0b0 | |
parent | 5d3b51d058c2fe7517f8bc65be23dc0ce89c2398 (diff) | |
download | hydra-77296b33f8394b30dceba39ab995a1a449aed271.tar.gz hydra-77296b33f8394b30dceba39ab995a1a449aed271.tar.bz2 |
Cleanup on hydra mass execution
-rwxr-xr-x | share/hydra/mass | 31 | ||||
-rwxr-xr-x | share/hydractl/puppet-reset-master | 2 |
2 files changed, 14 insertions, 19 deletions
diff --git a/share/hydra/mass b/share/hydra/mass index 64ad8e0..3aebd22 100755 --- a/share/hydra/mass +++ b/share/hydra/mass @@ -5,17 +5,12 @@ # Issue commands with pssh function mass_pssh { - echo "Issuing $COMMAND on multiple nodes..." - hydra_set_tmpfile nodes - echo $NODES > $TMPWORK - parallel-ssh -t 40 -P -h $TMPWORK sudo $COMMAND - hydra_unset_tmpfile $TMPWORK + parallel-ssh -t 120 -P -p 4 -h $TMPWORK sudo $COMMAND } # Issue commands with a for loop function mass_loop { - for node in $NODES; do - echo "Issuing $COMMAND on multiple nodes..." + for node in `cat $TMPWORK`; do echo "Connecting to $node..." $HYDRA_CONNECT $node sudo $COMMAND done @@ -23,20 +18,18 @@ function mass_loop { # Issue commands with dish function mass_dish { - echo "Issuing $COMMAND on multiple nodes..." - hydra_set_tmpfile nodes - echo $NODES > $TMPWORK dish -f -p /dev/null -e "sudo $COMMAND" -g $TMPWORK - hydra_unset_tmpfile $TMPWORK } # Issue commands with mussh function mass_mussh { - echo "Issuing $COMMAND on multiple nodes..." - hydra_set_tmpfile nodes - echo $NODES > $TMPWORK mussh -H $TMPWORK -c "sudo $COMMAND" - hydra_unset_tmpfile $TMPWORK +} + +# Set nodes +function set_nodes { + hydra_set_tmpfile nodes + hydra $HYDRA nodes $1 > $TMPWORK } # Load @@ -48,7 +41,8 @@ BASENAME="`basename $0`" COMMAND="$*" # Initial node list -NODES="`hydra $HYDRA nodes`" +BASEDIR="/tmp" +set_nodes # Validation if [ "$BASENAME" == "mass-update" ]; then @@ -56,9 +50,10 @@ if [ "$BASENAME" == "mass-update" ]; then elif [ "$BASENAME" == "mass-upgrade" ]; then COMMAND="aptitude safe-upgrade -y" elif [ "$BASENAME" == "mass-web" ]; then - NODES="`hydra $HYDRA nodes web`" + set_nodes web fi # Execute commands in hosts -BASEDIR="/tmp" +echo "Issuing $COMMAND on multiple nodes..." mass_pssh $COMMAND +hydra_unset_tmpfile $TMPWORK diff --git a/share/hydractl/puppet-reset-master b/share/hydractl/puppet-reset-master index ee1c888..5a4386e 100755 --- a/share/hydractl/puppet-reset-master +++ b/share/hydractl/puppet-reset-master @@ -19,5 +19,5 @@ chown -R puppet.puppet /etc/puppet/ # Start services /etc/init.d/puppetmaster start -sleep 10 +sleep 5 /etc/init.d/nginx start |