From 27d5f6ed785b6e127cf9a2f1145fac21627a9a89 Mon Sep 17 00:00:00 2001 From: Ward Vandewege Date: Tue, 18 Nov 2014 16:31:54 -0500 Subject: [PATCH] Do not blow up when another puppet process is already running during deploy. No issue # --- jenkins/run-deploy.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jenkins/run-deploy.sh b/jenkins/run-deploy.sh index a55678b..599dff3 100755 --- a/jenkins/run-deploy.sh +++ b/jenkins/run-deploy.sh @@ -148,11 +148,12 @@ if [[ "$COMPRESSED_NODE_LIST" != '' ]]; then SUM_ECODE=0 for node in $COMPUTE_NODES; do echo "Updating $node.$IDENTIFIER" - ssh -p2222 -o "StrictHostKeyChecking no" -o "ConnectTimeout 5" root@$node.$IDENTIFIER -C "/usr/bin/puppet agent -t" + RESULT=`ssh -p2222 -o "StrictHostKeyChecking no" -o "ConnectTimeout 5" root@$node.$IDENTIFIER -C "/usr/bin/puppet agent -t"` ECODE=$? - if [[ "$ECODE" != "255" && "$ECODE" != "2" && "$ECODE" != "0" ]]; then + if [[ "$ECODE" != "255" && ! ("$RESULT" =~ 'already in progress') && "$ECODE" != "2" && "$ECODE" != "0" ]]; then # 255 -> connection timed out. Just ignore that, it's possible the compute node was being shut down. # Puppet exits '2' if there are changes. For real! + # Puppet prints 'Notice: Run of Puppet configuration client already in progress' if another puppet process was already running SUM_ECODE=$(($SUM_ECODE + $ECODE)) echo "ERROR updating $node.$IDENTIFIER: exit code $ECODE" fi -- 2.30.2