mirror of
https://github.com/ansible/ansible.git
synced 2025-11-30 23:16:08 +07:00
ansible-test - Fix traceback on missing tmp dir (#85814)
This commit is contained in:
2
changelogs/fragments/ansible-test-missing-dir-fix.yml
Normal file
2
changelogs/fragments/ansible-test-missing-dir-fix.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-test - Fix a traceback that can occur when using delegation before the ansible-test temp directory is created.
|
||||
@@ -124,6 +124,8 @@ def delegate(args: CommonConfig, host_state: HostState, exclude: list[str], requ
|
||||
@contextlib.contextmanager
|
||||
def metadata_context(args: EnvironmentConfig) -> t.Generator[None]:
|
||||
"""A context manager which exports delegation metadata."""
|
||||
os.makedirs(ResultType.TMP.path, exist_ok=True)
|
||||
|
||||
with tempfile.NamedTemporaryFile(prefix='metadata-', suffix='.json', dir=ResultType.TMP.path) as metadata_fd:
|
||||
args.metadata_path = os.path.join(ResultType.TMP.relative_path, os.path.basename(metadata_fd.name))
|
||||
args.metadata.to_file(args.metadata_path)
|
||||
|
||||
Reference in New Issue
Block a user