Merge "zuul_stream : Use !127.0.0.1 for loopback"

This commit is contained in:
Zuul
2022-09-08 21:05:02 +00:00
committed by Gerrit Code Review
4 changed files with 9 additions and 10 deletions

View File

@@ -18,4 +18,4 @@
- name: Accept host keys - name: Accept host keys
shell: | shell: |
ssh-keyscan -p 2022 localhost >> ~/.ssh/known_hosts ssh-keyscan -p 2022 localhost >> ~/.ssh/known_hosts
ssh-keyscan -p 2022 127.0.0.1 >> ~/.ssh/known_hosts ssh-keyscan -p 2022 127.0.0.2 >> ~/.ssh/known_hosts

View File

@@ -23,7 +23,7 @@
hosts: hosts:
node3: node3:
ansible_connection: ssh ansible_connection: ssh
ansible_host: 127.0.0.1 ansible_host: 127.0.0.2
ansible_port: 2022 ansible_port: 2022
ansible_user: root ansible_user: root
ansible_python_interpreter: /usr/local/bin/python2.7 ansible_python_interpreter: /usr/local/bin/python2.7

View File

@@ -19,7 +19,6 @@
ZUUL_JOB_LOG_CONFIG: "{{ ansible_user_dir}}/logging.json" ZUUL_JOB_LOG_CONFIG: "{{ ansible_user_dir}}/logging.json"
ZUUL_JOBDIR: "{{ ansible_user_dir}}" ZUUL_JOBDIR: "{{ ansible_user_dir}}"
PYTHONPATH: "{{ python_path }}" PYTHONPATH: "{{ python_path }}"
ZUUL_CONSOLE_STREAM_LOCALHOST: 1
register: _success_output register: _success_output
- name: Save raw output to file - name: Save raw output to file

View File

@@ -48,10 +48,12 @@ from zuul.ansible import paths
from zuul.ansible import logconfig from zuul.ansible import logconfig
LOG_STREAM_PORT = int(os.environ.get("ZUUL_CONSOLE_PORT", 19885))
LOG_STREAM_VERSION = 0 LOG_STREAM_VERSION = 0
#
LOG_STREAM_LOCALHOST = int(os.environ.get("ZUUL_CONSOLE_STREAM_LOCALHOST", 0)) # This is intended to be only used for testing where we change the
# port so we can run another instance that doesn't conflict with one
# setup by the test environment
LOG_STREAM_PORT = int(os.environ.get("ZUUL_CONSOLE_PORT", 19885))
def zuul_filter_result(result): def zuul_filter_result(result):
@@ -322,15 +324,13 @@ class CallbackModule(default.CallbackModule):
hosts = self._get_task_hosts(task) hosts = self._get_task_hosts(task)
for host, inventory_hostname in hosts: for host, inventory_hostname in hosts:
port = LOG_STREAM_PORT port = LOG_STREAM_PORT
if (host in ('localhost', '127.0.0.1') and if (host in ('localhost', '127.0.0.1')):
not LOG_STREAM_LOCALHOST):
# Don't try to stream from localhost # Don't try to stream from localhost
continue continue
ip = play_vars[host].get( ip = play_vars[host].get(
'ansible_host', play_vars[host].get( 'ansible_host', play_vars[host].get(
'ansible_inventory_host')) 'ansible_inventory_host'))
if (ip in ('localhost', '127.0.0.1') and if (ip in ('localhost', '127.0.0.1')):
not LOG_STREAM_LOCALHOST):
# Don't try to stream from localhost # Don't try to stream from localhost
continue continue
if play_vars[host].get('ansible_connection') in ('winrm',): if play_vars[host].get('ansible_connection') in ('winrm',):