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
(cherry picked from commit 37dee4aa03
)
This commit is contained in:
parent
99c29dd7b5
commit
39e37c03d5
|
@ -563,7 +563,8 @@ class AnsiblePlaybookAction(base.TripleOAction):
|
|||
lines = []
|
||||
for line in iter(process.stdout.readline, b''):
|
||||
lines.append(line)
|
||||
stdout.append(line)
|
||||
if not self.trash_output:
|
||||
stdout.append(line)
|
||||
if time.time() - start > 30:
|
||||
self.post_message(queue, ''.join(lines))
|
||||
lines = []
|
||||
|
@ -575,9 +576,6 @@ class AnsiblePlaybookAction(base.TripleOAction):
|
|||
# stdout we don't know the difference. To keep the return dict
|
||||
# similar there is an empty stderr. We can use the return code
|
||||
# to determine if there was an error.
|
||||
if self.trash_output:
|
||||
stdout = []
|
||||
stderr = ""
|
||||
return {"stdout": "".join(stdout), "returncode": returncode,
|
||||
"stderr": ""}
|
||||
|
||||
|
|
Loading…
Reference in New Issue