]> review.fuel-infra Code Review - tools/sustaining.git/commitdiff
Jenkins' job output fix 06/16606/1
authorDenis V. Meltsaykin <dmeltsaykin@mirantis.com>
Tue, 2 Feb 2016 06:54:29 +0000 (09:54 +0300)
committerDenis V. Meltsaykin <dmeltsaykin@mirantis.com>
Tue, 2 Feb 2016 06:54:40 +0000 (09:54 +0300)
sys.stdout.write() does not guarantee that the output will show up,
as buffers need to be explicitly flushed. The more suitable solution is
to use the print_function from __future__.

Change-Id: Ic85e36172377fd21952a5711e2553ef5a803da40

jenkins/build_cluster/build_cluster.py

index 28f229ef358763caa61952d625ae01cb1932fa7d..6b94d9486251433730e4e080bc4b6fc340adf461 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 import os
 import re
 import signal
@@ -435,7 +437,7 @@ def inject_ifconfig_ssh():
             return True
         else:
             retries += 1
-            sys.stdout.write("{0}...".format(retries))
+            print("{0}...".format(retries), end='')
             time.sleep(60)
 
 
@@ -452,7 +454,7 @@ def wait_for_api_is_ready():
            "{usr}@{admip}".format(usr=cfg["FUEL_SSH_USERNAME"],
                                   admip=str(cfg["ADMIN_SUBNET"].ip + 2)),
            "/usr/bin/fuel env"]
-    sys.stdout.write("Waiting until Nailgun API is ready: ")
+    print("Waiting until Nailgun API is ready: ", end='')
     retries = 0
     while retries < 50:
         proc = subprocess.Popen(cmd, stdin=None, stdout=dnl, stderr=dnl)
@@ -463,7 +465,7 @@ def wait_for_api_is_ready():
             return True
         else:
             retries += 1
-            sys.stdout.write("{0}...".format(retries))
+            print("{0}...".format(retries), end='')
             time.sleep(60)
     return False