Fix ansible-test --docker without tests dir.

pull/68839/head
Matt Clay 5 years ago
parent d86d20a378
commit a095172130

@ -0,0 +1,2 @@
bugfixes:
- ansible-test no longer fails when downloading test results for a collection without a ``tests`` directory when using the ``--docker`` option.

@ -9,6 +9,10 @@ import tempfile
from . import types as t from . import types as t
from .io import (
make_dirs,
)
from .executor import ( from .executor import (
SUPPORTED_PYTHON_VERSIONS, SUPPORTED_PYTHON_VERSIONS,
HTTPTESTER_HOSTS, HTTPTESTER_HOSTS,
@ -363,6 +367,8 @@ def delegate_docker(args, exclude, require, integration_targets):
remote_results_name = os.path.basename(remote_results_root) remote_results_name = os.path.basename(remote_results_root)
remote_temp_file = os.path.join('/root', remote_results_name + '.tgz') remote_temp_file = os.path.join('/root', remote_results_name + '.tgz')
make_dirs(local_test_root) # make sure directory exists for collections which have no tests
with tempfile.NamedTemporaryFile(prefix='ansible-result-', suffix='.tgz') as local_result_fd: with tempfile.NamedTemporaryFile(prefix='ansible-result-', suffix='.tgz') as local_result_fd:
docker_exec(args, test_id, ['tar', 'czf', remote_temp_file, '--exclude', ResultType.TMP.name, '-C', remote_test_root, remote_results_name]) docker_exec(args, test_id, ['tar', 'czf', remote_temp_file, '--exclude', ResultType.TMP.name, '-C', remote_test_root, remote_results_name])
docker_get(args, test_id, remote_temp_file, local_result_fd.name) docker_get(args, test_id, remote_temp_file, local_result_fd.name)

Loading…
Cancel
Save