mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-08 14:23:11 +00:00
ansible-ipa-*-install: Get continuous output working for python2 also
The used code for continuous output from the ansible-playbook call was only working for Python2. The output has only been printed when the command finised. This code has been replaced with code that is working with Python2 and Python3.
This commit is contained in:
@@ -227,9 +227,11 @@ def run_cmd(args):
|
||||
p = subprocess.Popen(args, stdout=p_out, stderr=p_err,
|
||||
close_fds=True, bufsize=1,
|
||||
universal_newlines=True)
|
||||
with p.stdout:
|
||||
for line in p.stdout:
|
||||
sys.stdout.write(line)
|
||||
while True:
|
||||
line = p.stdout.readline()
|
||||
if p.poll() is not None and line == "":
|
||||
break
|
||||
sys.stdout.write(line)
|
||||
except KeyboardInterrupt:
|
||||
p.wait()
|
||||
raise
|
||||
|
||||
@@ -295,9 +295,11 @@ def run_cmd(args):
|
||||
p = subprocess.Popen(args, stdout=p_out, stderr=p_err,
|
||||
close_fds=True, bufsize=1,
|
||||
universal_newlines=True)
|
||||
with p.stdout:
|
||||
for line in p.stdout:
|
||||
sys.stdout.write(line)
|
||||
while True:
|
||||
line = p.stdout.readline()
|
||||
if p.poll() is not None and line == "":
|
||||
break
|
||||
sys.stdout.write(line)
|
||||
except KeyboardInterrupt:
|
||||
p.wait()
|
||||
raise
|
||||
|
||||
@@ -331,9 +331,11 @@ def run_cmd(args):
|
||||
p = subprocess.Popen(args, stdout=p_out, stderr=p_err,
|
||||
close_fds=True, bufsize=1,
|
||||
universal_newlines=True)
|
||||
with p.stdout:
|
||||
for line in p.stdout:
|
||||
sys.stdout.write(line)
|
||||
while True:
|
||||
line = p.stdout.readline()
|
||||
if p.poll() is not None and line == "":
|
||||
break
|
||||
sys.stdout.write(line)
|
||||
except KeyboardInterrupt:
|
||||
p.wait()
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user