Add startup checks to ansible-test.

pull/20617/head
Matt Clay 8 years ago
parent b4a1542670
commit fa7f84217b

@ -2,6 +2,7 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
import errno
import glob import glob
import os import os
import tempfile import tempfile
@ -84,6 +85,23 @@ COMPILE_PYTHON_VERSIONS = tuple(sorted(SUPPORTED_PYTHON_VERSIONS + ('2.4',)))
coverage_path = '' # pylint: disable=locally-disabled, invalid-name coverage_path = '' # pylint: disable=locally-disabled, invalid-name
def check_startup():
"""Checks to perform at startup before running commands."""
check_legacy_modules()
def check_legacy_modules():
"""Detect conflicts with legacy core/extras module directories to avoid problems later."""
for directory in 'core', 'extras':
path = 'lib/ansible/modules/%s' % directory
for root, _, file_names in os.walk(path):
if file_names:
# the directory shouldn't exist, but if it does, it must contain no files
raise ApplicationError('Files prohibited in "%s". '
'These are most likely legacy modules from version 2.2 or earlier.' % root)
def create_shell_command(command): def create_shell_command(command):
""" """
:type command: list[str] :type command: list[str]

@ -39,6 +39,7 @@ from lib.executor import (
ApplicationWarning, ApplicationWarning,
Delegate, Delegate,
generate_pip_install, generate_pip_install,
check_startup,
) )
from lib.target import ( from lib.target import (
@ -67,6 +68,7 @@ def main():
config = args.config(args) config = args.config(args)
display.verbosity = config.verbosity display.verbosity = config.verbosity
display.color = config.color display.color = config.color
check_startup()
try: try:
args.func(config) args.func(config)

Loading…
Cancel
Save