mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Add startup checks to ansible-test.
This commit is contained in:
parent
b4a1542670
commit
fa7f84217b
2 changed files with 20 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
import errno
|
||||
import glob
|
||||
import os
|
||||
import tempfile
|
||||
|
@ -84,6 +85,23 @@ COMPILE_PYTHON_VERSIONS = tuple(sorted(SUPPORTED_PYTHON_VERSIONS + ('2.4',)))
|
|||
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):
|
||||
"""
|
||||
:type command: list[str]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue