summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/ansible_test/_internal/__init__.py')
-rw-r--r--test/lib/ansible_test/_internal/__init__.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/lib/ansible_test/_internal/__init__.py b/test/lib/ansible_test/_internal/__init__.py
index e604a2b35a..18e776ad74 100644
--- a/test/lib/ansible_test/_internal/__init__.py
+++ b/test/lib/ansible_test/_internal/__init__.py
@@ -3,6 +3,7 @@ from __future__ import annotations
import os
import sys
+import typing as t
# This import should occur as early as possible.
# It must occur before subprocess has been imported anywhere in the current process.
@@ -10,10 +11,14 @@ from .init import (
CURRENT_RLIMIT_NOFILE,
)
+from .constants import (
+ STATUS_HOST_CONNECTION_ERROR,
+)
+
from .util import (
ApplicationError,
+ HostConnectionError,
display,
- MAXFD,
)
from .delegation import (
@@ -57,16 +62,18 @@ def main():
display.truncate = config.truncate
display.redact = config.redact
display.color = config.color
- display.info_stderr = config.info_stderr
+ display.fd = sys.stderr if config.display_stderr else sys.stdout
configure_timeout(config)
display.info('RLIMIT_NOFILE: %s' % (CURRENT_RLIMIT_NOFILE,), verbosity=2)
- display.info('MAXFD: %d' % MAXFD, verbosity=2)
delegate_args = None
target_names = None
try:
+ if config.check_layout:
+ data_context().check_layout()
+
args.func(config)
except PrimeContainers:
pass
@@ -78,20 +85,23 @@ def main():
delegate_args = (ex.host_state, ex.exclude, ex.require)
if delegate_args:
- # noinspection PyTypeChecker
delegate(config, *delegate_args)
if target_names:
for target_name in target_names:
- print(target_name) # info goes to stderr, this should be on stdout
+ print(target_name) # display goes to stderr, this should be on stdout
display.review_warnings()
config.success = True
+ except HostConnectionError as ex:
+ display.fatal(str(ex))
+ ex.run_callback()
+ sys.exit(STATUS_HOST_CONNECTION_ERROR)
except ApplicationWarning as ex:
display.warning(u'%s' % ex)
sys.exit(0)
except ApplicationError as ex:
- display.error(u'%s' % ex)
+ display.fatal(u'%s' % ex)
sys.exit(1)
except KeyboardInterrupt:
sys.exit(2)