Giuseppe Lavagetto has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312194

Change subject: puppet-merge: only sync to other machines if a sha1 is not 
provided.
......................................................................

puppet-merge: only sync to other machines if a sha1 is not provided.

Change-Id: I7ad711534b4b46d8853c252fbca8fe17fbe6824f
---
M modules/puppetmaster/templates/puppet-merge.erb
1 file changed, 13 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/94/312194/1

diff --git a/modules/puppetmaster/templates/puppet-merge.erb 
b/modules/puppetmaster/templates/puppet-merge.erb
index 871de86..0a853f7 100755
--- a/modules/puppetmaster/templates/puppet-merge.erb
+++ b/modules/puppetmaster/templates/puppet-merge.erb
@@ -182,20 +182,23 @@
 # Note: The "true" command is passed on purpose to show that the command passed
 # to the SSH sessions is irrelevant. It's the SSH forced command trick on the
 # worker end that does the actual work. Note that the $sha1 however is 
important
+
+if [ -z ${sha1} ]; then # Only loop through the other servers if called 
without sha1
   <%- @servers.each do |frontend, workers| -%>
     <%- workers.map{ |w| w['worker']}.select{|name| name != @fqdn}.each do 
|worker| -%>
-if [ $running_user = $git_user ]; then
-    ssh -t -t <%= worker -%> true ${fetch_head_sha1} 2>&1 | tee -a 
/var/log/puppet-post-merge.log
-else
-    su - $git_user -c "ssh -t -t <%= worker -%> true ${fetch_head_sha1} 2>&1 | 
tee -a /var/log/puppet-post-merge.log"
-fi
-if [ $? -eq 0 ]; then
-    echo "${GREEN}OK${RESET}: puppet-merge on <%= worker %> succeded"
-else
-    echo "${RED}ERROR${RESET}: puppet-merge on <%= worker %> failed"
-fi
+    if [ $running_user = $git_user ]; then
+        ssh -t -t <%= worker -%> true ${fetch_head_sha1} 2>&1 | tee -a 
/var/log/puppet-post-merge.log
+    else
+        su - $git_user -c "ssh -t -t <%= worker -%> true ${fetch_head_sha1} 
2>&1 | tee -a /var/log/puppet-post-merge.log"
+    fi
+    if [ $? -eq 0 ]; then
+        echo "${GREEN}OK${RESET}: puppet-merge on <%= worker %> succeded"
+    else
+        echo "${RED}ERROR${RESET}: puppet-merge on <%= worker %> failed"
+    fi
     <%- end -%>
   <%- end -%>
+fi
 # conftool-merge does need to run from >1 frontend, avoid running a second time
 if [ $running_user != $git_user ]; then
     echo "Now running conftool-merge to sync any changes to conftool data"

-- 
To view, visit https://gerrit.wikimedia.org/r/312194
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ad711534b4b46d8853c252fbca8fe17fbe6824f
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to