Muehlenhoff has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373075 )

Change subject: Hide Cumin output in restarts detection
......................................................................


Hide Cumin output in restarts detection

Also display unreachable hosts.

Change-Id: I47ae3a4f94e87d7eed5107bcfc6c1d21b6b7448d
---
M server/debdeploy.py
1 file changed, 29 insertions(+), 21 deletions(-)

Approvals:
  Muehlenhoff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/server/debdeploy.py b/server/debdeploy.py
index 2ea9d6d..5ca64be 100755
--- a/server/debdeploy.py
+++ b/server/debdeploy.py
@@ -128,33 +128,32 @@
     verbose     : If enabled, the full of hosts needing a restart is shown 
(boolean)
     '''
 
-    worker = transport.Transport.new(cumin_config, logging)
-    hosts = query.Query(cumin_config).execute('A:all')
+    with open('/dev/null', 'w') as discard_output:
+         oldstdout = sys.stdout
+         oldstderr = sys.stderr
+         sys.stdout = discard_output
+         sys.stderr = discard_output
 
-    cmd = '/usr/bin/debdeploy-restarts --json --libname '
-    for lib in libnames:
-        cmd += lib + " "
+         worker = transport.Transport.new(cumin_config, logging)
+         hosts = query.Query(cumin_config).execute('A:all')
 
-    worker.target = transports.Target(hosts, batch_size=100, batch_sleep=None, 
logger=logging)
-    worker.commands = [cmd]
+         cmd = '/usr/bin/debdeploy-restarts --json --libname '
+         for lib in libnames:
+             cmd += lib + " "
 
-    worker.timeout = None
-    worker.handler = 'sync'
-    worker.success_threshold = 0.1
-    worker.batch_size = 100
-    worker.batch_sleep = None
+         worker.target = transports.Target(hosts, batch_size=100, 
batch_sleep=None, logger=logging)
+         worker.commands = [cmd]
 
-    # with open('/dev/null', 'w') as discard_output:
-    #     oldstdout = sys.stdout
-    #     sys.stdout = discard_output
-    #     exit_code = worker.execute()
-    #     sys.stdout = oldstdout
-
-    exit_code = worker.execute()
+         worker.timeout = None
+         worker.handler = 'sync'
+         worker.success_threshold = 0.1
+         worker.batch_size = 100
+         worker.batch_sleep = None
+         exit_code = worker.execute()
+         sys.stdout = oldstdout
+         sys.stderr = oldstderr
 
     restarts_per_lib = {}
-
-    out = {}
     for nodeset, output in worker.get_results():
         msg = str(output)
         hostname = str(nodeset)
@@ -180,6 +179,15 @@
                 out += " (" + str(len(restarts_per_lib[lib][program])) + " 
hosts)"
             print out
 
+    unreachable_hosts = []
+    for node in worker._handler_instance.nodes.itervalues():
+        if node.state.is_failed:
+            unreachable_hosts.append(node.name)
+    if len(unreachable_hosts) > 0:
+        print "The following hosts were unreachable:"
+        for host in unreachable_hosts:
+            print host
+
 
 def main():
     p = argparse.ArgumentParser(usage="""debdeploy-master [options] command 
<cmd-option> \n

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I47ae3a4f94e87d7eed5107bcfc6c1d21b6b7448d
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/debdeploy
Gerrit-Branch: master
Gerrit-Owner: Muehlenhoff <[email protected]>
Gerrit-Reviewer: Muehlenhoff <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to