Don't accumulate ansible output uselessly
To not overload mistral, we often call the ansible playbook action with "trash_output". When that's the case, we can discard stdout immediately, instead of accumulating it and then discarding it. Change-Id: Ia3d05d716a8e0a1665f9b9310f7d25370bbcdf8d
This commit is contained in:
parent
7caf2065ba
commit
37dee4aa03
|
@ -562,7 +562,8 @@ class AnsiblePlaybookAction(base.TripleOAction):
|
||||||
lines = []
|
lines = []
|
||||||
for line in iter(process.stdout.readline, b''):
|
for line in iter(process.stdout.readline, b''):
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
stdout.append(line)
|
if not self.trash_output:
|
||||||
|
stdout.append(line)
|
||||||
if time.time() - start > 30:
|
if time.time() - start > 30:
|
||||||
self.post_message(queue, ''.join(lines))
|
self.post_message(queue, ''.join(lines))
|
||||||
lines = []
|
lines = []
|
||||||
|
@ -574,9 +575,6 @@ class AnsiblePlaybookAction(base.TripleOAction):
|
||||||
# stdout we don't know the difference. To keep the return dict
|
# stdout we don't know the difference. To keep the return dict
|
||||||
# similar there is an empty stderr. We can use the return code
|
# similar there is an empty stderr. We can use the return code
|
||||||
# to determine if there was an error.
|
# to determine if there was an error.
|
||||||
if self.trash_output:
|
|
||||||
stdout = []
|
|
||||||
stderr = ""
|
|
||||||
return {"stdout": "".join(stdout), "returncode": returncode,
|
return {"stdout": "".join(stdout), "returncode": returncode,
|
||||||
"stderr": ""}
|
"stderr": ""}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue