From 2e8052b40ac9722ac3279586bf89491660fa7e46 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 1 Jul 2017 08:39:44 -0500 Subject: [PATCH] Apply localhost workaround if ansible_host is localhost This shouldn't really ever happen for real in zuul, but just in case we do something in a trusted playbook somewhere like setting ansible_host to localhost, the code should at least do the right thing. (This comes up more in doing local testing of plugins) Change-Id: I638fa5f8cd69cd46823ea42bc4e257972d125945 --- zuul/ansible/callback/zuul_stream.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zuul/ansible/callback/zuul_stream.py b/zuul/ansible/callback/zuul_stream.py index 6d27f1563c..c6cc7ab4ac 100644 --- a/zuul/ansible/callback/zuul_stream.py +++ b/zuul/ansible/callback/zuul_stream.py @@ -172,6 +172,9 @@ class CallbackModule(default.CallbackModule): ip = play_vars[host].get( 'ansible_host', play_vars[host].get( 'ansible_inventory_host')) + if ip in ('localhost', '127.0.0.1'): + # Don't try to stream from localhost + continue streamer = threading.Thread( target=self._read_log, args=( host, ip, log_id, task_name, hosts))