Skip to content

Commit

Permalink
2.14 and newer can skip printing in forks
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel committed Jan 27, 2025
1 parent 0ad67a3 commit 163d5b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/ansible_runner/display_callback/callback/awx_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions src/ansible_runner/utils/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 163d5b7

Please sign in to comment.