mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix ansible-test config management.
This commit is contained in:
parent
aa658c64ec
commit
a333f2e5b0
5 changed files with 17 additions and 5 deletions
0
test/integration/integration.cfg
Normal file
0
test/integration/integration.cfg
Normal file
0
test/integration/windows-integration.cfg
Normal file
0
test/integration/windows-integration.cfg
Normal file
|
@ -4,7 +4,14 @@ from __future__ import absolute_import, print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from lib.util import common_environment
|
from lib.util import (
|
||||||
|
common_environment,
|
||||||
|
ApplicationError,
|
||||||
|
)
|
||||||
|
|
||||||
|
from lib.config import (
|
||||||
|
IntegrationConfig,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def ansible_environment(args, color=True):
|
def ansible_environment(args, color=True):
|
||||||
|
@ -21,19 +28,24 @@ def ansible_environment(args, color=True):
|
||||||
if not path.startswith(ansible_path + os.pathsep):
|
if not path.startswith(ansible_path + os.pathsep):
|
||||||
path = ansible_path + os.pathsep + path
|
path = ansible_path + os.pathsep + path
|
||||||
|
|
||||||
|
if isinstance(args, IntegrationConfig):
|
||||||
|
ansible_config = 'test/integration/%s.cfg' % args.command
|
||||||
|
else:
|
||||||
|
ansible_config = 'test/%s/ansible.cfg' % args.command
|
||||||
|
|
||||||
|
if not os.path.exists(ansible_config):
|
||||||
|
raise ApplicationError('Configuration not found: %s' % ansible_config)
|
||||||
|
|
||||||
ansible = dict(
|
ansible = dict(
|
||||||
ANSIBLE_FORCE_COLOR='%s' % 'true' if args.color and color else 'false',
|
ANSIBLE_FORCE_COLOR='%s' % 'true' if args.color and color else 'false',
|
||||||
ANSIBLE_DEPRECATION_WARNINGS='false',
|
ANSIBLE_DEPRECATION_WARNINGS='false',
|
||||||
ANSIBLE_HOST_KEY_CHECKING='false',
|
ANSIBLE_HOST_KEY_CHECKING='false',
|
||||||
|
ANSIBLE_CONFIG=os.path.abspath(ansible_config),
|
||||||
PYTHONPATH=os.path.abspath('lib'),
|
PYTHONPATH=os.path.abspath('lib'),
|
||||||
PAGER='/bin/cat',
|
PAGER='/bin/cat',
|
||||||
PATH=path,
|
PATH=path,
|
||||||
)
|
)
|
||||||
|
|
||||||
if os.path.isfile('test/integration/%s.cfg' % args.command):
|
|
||||||
ansible_config = os.path.abspath('test/integration/%s.cfg' % args.command)
|
|
||||||
ansible['ANSIBLE_CONFIG'] = ansible_config
|
|
||||||
|
|
||||||
env.update(ansible)
|
env.update(ansible)
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
|
|
0
test/sanity/ansible.cfg
Normal file
0
test/sanity/ansible.cfg
Normal file
0
test/units/ansible.cfg
Normal file
0
test/units/ansible.cfg
Normal file
Loading…
Reference in a new issue