File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ import atexit
56import contextlib
67import importlib .util
78import io
89import json
910import logging
1011import re
12+ import shutil
1113import sys
14+ import tempfile
1215from typing import TYPE_CHECKING , Any
1316
1417# pylint: disable=preferred-module
6063 # https://github.com/ansible/ansible-lint/issues/3152
6164 "ansible.posix.synchronize" : ["use_ssh_args" ],
6265}
66+ _SAFE_ASYNC_DIR = tempfile .mkdtemp (prefix = "ansible-lint-async-" )
67+
68+
69+ def _cleanup_async_dir () -> None :
70+ """Safely remove the temp directory and all its contents."""
71+ shutil .rmtree (_SAFE_ASYNC_DIR , ignore_errors = True )
72+
73+
74+ atexit .register (_cleanup_async_dir )
75+
6376workarounds_inject_map = {
6477 # https://github.com/ansible/ansible-lint/issues/2824
65- "ansible.builtin.async_status" : {"_async_dir" : "/tmp/ansible-async" },
78+ "ansible.builtin.async_status" : {"_async_dir" : _SAFE_ASYNC_DIR },
6679}
6780workarounds_mutex_args_map = {
6881 # https://github.com/ansible/ansible-lint/issues/4623
You can’t perform that action at this time.
0 commit comments