summaryrefslogtreecommitdiff
path: root/zuul/ansible
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2022-08-17 07:44:52 +1000
committerIan Wienand <iwienand@redhat.com>2022-09-07 10:48:25 +1000
commit34543b8ac55348bc7d55f465231d6f9ca7aded3d (patch)
treeff210867981271ec1de9a75b1b9b661d0ff73ac9 /zuul/ansible
parent64fa9db5799d33838267183f5c6734d4ba5ee7c9 (diff)
downloadzuul-34543b8ac55348bc7d55f465231d6f9ca7aded3d.tar.gz
zuul-stream : Test against a Python 2.7 container
Change Ief366c092e05fb88351782f6d9cd280bfae96237 intoduced a bug in the streaming daemons because it was using Python 3.6 features. The streaming console needs to work on all Ansible managed nodes, which includes back to Python 2.7 nodes (while Ansible supports that). This introduces a regression test by building about the smallest Python 2.7 container that can be managed by Ansbile. We start this container and modify the test inventory to include it, then run the stream tests against it. The existing testing runs against the "new" console but also tests against the console OpenDev's Zuul starts to ensure backwards-compatability. Since this container wasn't started by Zuul it doesn't have this, so that testing is skipped for this node. It might be good to abstract all testing of the console daemons into separate containers for each Ansible supported managed-node Python version -- it's a bit more work than I want to take on right now. This should ensure the lower-bound though and prevent regressions for older platforms. Change-Id: Ia78ad9e3ec51bc47bf68c9ff38c0fcd16ba2e728
Diffstat (limited to 'zuul/ansible')
-rw-r--r--zuul/ansible/base/callback/zuul_stream.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/zuul/ansible/base/callback/zuul_stream.py b/zuul/ansible/base/callback/zuul_stream.py
index 39d3aa953..740f48114 100644
--- a/zuul/ansible/base/callback/zuul_stream.py
+++ b/zuul/ansible/base/callback/zuul_stream.py
@@ -49,6 +49,8 @@ from zuul.ansible import logconfig
LOG_STREAM_PORT = int(os.environ.get("ZUUL_CONSOLE_PORT", 19885))
LOG_STREAM_VERSION = 0
+#
+LOG_STREAM_LOCALHOST = int(os.environ.get("ZUUL_CONSOLE_STREAM_LOCALHOST", 0))
def zuul_filter_result(result):
@@ -319,13 +321,15 @@ class CallbackModule(default.CallbackModule):
hosts = self._get_task_hosts(task)
for host, inventory_hostname in hosts:
port = LOG_STREAM_PORT
- if host in ('localhost', '127.0.0.1'):
+ if (host in ('localhost', '127.0.0.1') and
+ not LOG_STREAM_LOCALHOST):
# Don't try to stream from localhost
continue
ip = play_vars[host].get(
'ansible_host', play_vars[host].get(
'ansible_inventory_host'))
- if ip in ('localhost', '127.0.0.1'):
+ if (ip in ('localhost', '127.0.0.1') and
+ not LOG_STREAM_LOCALHOST):
# Don't try to stream from localhost
continue
if play_vars[host].get('ansible_connection') in ('winrm',):