Do not blow up when another puppet process is already running during deploy.
authorWard Vandewege <ward@curoverse.com>
Tue, 18 Nov 2014 21:31:54 +0000 (16:31 -0500)
committerWard Vandewege <ward@curoverse.com>
Tue, 18 Nov 2014 21:33:33 +0000 (16:33 -0500)
No issue #

jenkins/run-deploy.sh

index a55678bc69a4cc8301fde6fa7e52b0fd80464e1a..599dff3903455b926a60b147a5ec68ff3a77a92d 100755 (executable)
@@ -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