From 5bd780d3502dda19c9f28d7e84e678199b124e1d Mon Sep 17 00:00:00 2001 From: "Denis V. Meltsaykin" Date: Tue, 2 Feb 2016 09:54:29 +0300 Subject: [PATCH] Jenkins' job output fix 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jenkins/build_cluster/build_cluster.py b/jenkins/build_cluster/build_cluster.py index 28f229e..6b94d94 100755 --- a/jenkins/build_cluster/build_cluster.py +++ b/jenkins/build_cluster/build_cluster.py @@ -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 -- 2.45.2