Don't print twirl when stdout is redirected

Change-Id: Ieebf5471720904a60f3715cfb887100e8ab4628c
This commit is contained in:
Martin Magr
2013-02-25 18:53:57 +01:00
parent a799ec9754
commit 7b81fbe286

View File

@@ -106,6 +106,7 @@ def waitforpuppet(currently_running):
space_len = basedefs.SPACE_LEN - len(log_file)
if len(log_file) > log_len:
log_len = len(log_file)
if sys.stdout.isatty():
twirl = twirl[-1:] + twirl[:-1]
sys.stdout.write(("\rTesting if puppet apply is finished : %s" % log_file).ljust(40 + log_len))
sys.stdout.write("[ %s ]" % twirl[0])
@@ -124,6 +125,7 @@ def waitforpuppet(currently_running):
currently_running.remove((hostname, finished_logfile))
# clean off the last "testing apply" msg
if sys.stdout.isatty():
sys.stdout.write(("\r").ljust(45 + log_len))
except ScriptRuntimeError, e: