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
|
||||
|
||||
from lib.util import common_environment
|
||||
from lib.util import (
|
||||
common_environment,
|
||||
ApplicationError,
|
||||
)
|
||||
|
||||
from lib.config import (
|
||||
IntegrationConfig,
|
||||
)
|
||||
|
||||
|
||||
def ansible_environment(args, color=True):
|
||||
|
@ -21,19 +28,24 @@ def ansible_environment(args, color=True):
|
|||
if not path.startswith(ansible_path + os.pathsep):
|
||||
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_FORCE_COLOR='%s' % 'true' if args.color and color else 'false',
|
||||
ANSIBLE_DEPRECATION_WARNINGS='false',
|
||||
ANSIBLE_HOST_KEY_CHECKING='false',
|
||||
ANSIBLE_CONFIG=os.path.abspath(ansible_config),
|
||||
PYTHONPATH=os.path.abspath('lib'),
|
||||
PAGER='/bin/cat',
|
||||
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)
|
||||
|
||||
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