BryanDavis has uploaded a new change for review.

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

Change subject: Cleanup scap.ssh integration
......................................................................

Cleanup scap.ssh integration

* Fix bug in scap.tasks.scap.run_on_cluster where error component of
  return value from scap.ssh.cluster_monitor was incorrectly treated as
  a list.
* Change command specification for rsync wikiversions from list of
  arguments to string. The list of arguments version was difficult to
  read.
* Make scap.ssh.cluster_monitor's count of completed commands be 1-based
  rather than 0-based.
* Avoid adding an unneeded newline in scap.ssh.cluster_monitor when the
  first host returns an error.

Change-Id: I930ab34b100ab7deb804ce8546818e1d1dde5b98
---
M scap/ssh.py
M scap/tasks.py
2 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/scap 
refs/changes/44/114744/1

diff --git a/scap/ssh.py b/scap/ssh.py
index aadfa81..f6452fd 100644
--- a/scap/ssh.py
+++ b/scap/ssh.py
@@ -88,14 +88,15 @@
 
     try:
         for done, (host, status, output) in \
-                enumerate(cluster_ssh(hosts, command)):
+                enumerate(cluster_ssh(hosts, command), start=1):
             if status == 0:
                 ok += 1
             else:
                 failed += 1
-                # Start a new console line on the assumption that logger will
-                # be appending to console as well.
-                sys.stderr.write('\n')
+                if done > 1:
+                    # Start a new console line on the assumption that logger
+                    # will be appending to console as well.
+                    sys.stderr.write('\n')
                 logger.warning('%s on %s returned [%d]: %s',
                     description, host, status, output)
 
diff --git a/scap/tasks.py b/scap/tasks.py
index 09c41cd..0e3ea15 100644
--- a/scap/tasks.py
+++ b/scap/tasks.py
@@ -116,7 +116,7 @@
         (good, bad) = ssh.cluster_monitor(description, hosts, command)
 
         if bad:
-            logger.error('%s failed on %d hosts', description, len(bad))
+            logger.error('%s failed on %d hosts', description, bad)
 
     with utils.lock('/var/lock/scap'):
         logger.info('Started scap: %s', args.message)
@@ -160,8 +160,7 @@
             t.mark('refreshWikiversionsCDB')
 
             run_on_cluster('rsync wikiversions', mw_install_hosts,
-                ['rsync', '-l', '%(MW_RSYNC_HOST)s::common/'
-                'wikiversions.{json,cdb}' % args.cfg,
-                '%(MW_COMMON)s' % args.cfg],
+                '/usr/bin/rsync -l %(MW_RSYNC_HOST)s::common/'
+                'wikiversions.{json,cdb} %(MW_COMMON)s' % args.cfg,
                 user='mwdeploy')
             t.mark('rsync wikiversions')

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I930ab34b100ab7deb804ce8546818e1d1dde5b98
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/scap
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to