summaryrefslogtreecommitdiff
path: root/zuul/ansible/base/callback/zuul_stream.py
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2022-07-21 14:41:39 +1000
committerIan Wienand <iwienand@redhat.com>2022-08-09 17:04:46 +1000
commitdf3f9dcd30a13232447b3be67c7845c51cb527a0 (patch)
treee2f834ca9d0c0f4330309b64a1587db25ca09805 /zuul/ansible/base/callback/zuul_stream.py
parentc1b2fa55988b3f22b392086fe003bde2444ebbdc (diff)
downloadzuul-df3f9dcd30a13232447b3be67c7845c51cb527a0.tar.gz
zuul-stream: automatically remove streaming files
When using protocol version 1, send a finalise message when streaming is complete so that the zuul_console daemon can delete the temporary file. We test this by inspecting the Ansible console output, which logs a message with the UUID of the streaming job. We dump the temporary files on the remote side and make sure a console file for that job isn't present. Change-Id: I823156dc2bcae91bd6d9770bd1520aa55ad875b4
Diffstat (limited to 'zuul/ansible/base/callback/zuul_stream.py')
-rw-r--r--zuul/ansible/base/callback/zuul_stream.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/zuul/ansible/base/callback/zuul_stream.py b/zuul/ansible/base/callback/zuul_stream.py
index d33b4dda0..f31983ed6 100644
--- a/zuul/ansible/base/callback/zuul_stream.py
+++ b/zuul/ansible/base/callback/zuul_stream.py
@@ -211,6 +211,16 @@ class CallbackModule(default.CallbackModule):
done = self._log_streamline(
host, line.decode("utf-8", "backslashreplace"))
if done:
+ if self._zuul_console_version > 0:
+ try:
+ # reestablish connection and tell console to
+ # clean up
+ s = self._read_log_connect(host, ip, port)
+ s.send(f'f:{log_id}\n'.encode('utf-8'))
+ s.close()
+ except Exception:
+ # Don't worry if this fails
+ pass
return
else:
more = s.recv(4096)