From 163d5b7248d40f9d8e255af2faa30a5f847d3aad Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 27 Jan 2025 12:47:16 -0600 Subject: [PATCH] 2.14 and newer can skip printing in forks --- .../display_callback/callback/awx_display.py | 9 ++------- src/ansible_runner/utils/streaming.py | 3 --- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/ansible_runner/display_callback/callback/awx_display.py b/src/ansible_runner/display_callback/callback/awx_display.py index 6f6e8a716..b6849029e 100644 --- a/src/ansible_runner/display_callback/callback/awx_display.py +++ b/src/ansible_runner/display_callback/callback/awx_display.py @@ -70,7 +70,7 @@ CENSORED = "the output has been hidden due to the fact that 'no_log: true' was specified for this result" _ANSIBLE_VERSION = tuple(int(p) for p in ansible_version_str.split('.')[:2]) -_ANSIBLE_217 = _ANSIBLE_VERSION >= (2, 17) +_ANSIBLE_214 = _ANSIBLE_VERSION >= (2, 14) def current_time(): @@ -287,16 +287,11 @@ def wrapper(*args, **kwargs): Display.verbose = with_verbosity(Display.verbose) -@functools.lru_cache(maxsize=2) -def _is_child(): - return multiprocessing_context.parent_process() is not None - - def display_with_context(f): @functools.wraps(f) def wrapper(*args, **kwargs): - if _ANSIBLE_217 and _is_child(): + if _ANSIBLE_214 and multiprocessing_context.parent_process() is not None: return f(*args, **kwargs) log_only = args[5] if len(args) >= 6 else kwargs.get('log_only', False) diff --git a/src/ansible_runner/utils/streaming.py b/src/ansible_runner/utils/streaming.py index ce342fafd..0c004c8ac 100644 --- a/src/ansible_runner/utils/streaming.py +++ b/src/ansible_runner/utils/streaming.py @@ -24,9 +24,6 @@ def stream_dir(source_directory: str, stream: io.FileIO) -> None: if relpath == ".": relpath = "" for fname in files + dirs: - if fname.endswith('-partial.json'): - # Never stream partials - continue full_path = os.path.join(dirpath, fname) # Magic to preserve symlinks if os.path.islink(full_path):