From 72bfb051c32d7f58e475c4bb10a39918d98b4190 Mon Sep 17 00:00:00 2001 From: John R Barker Date: Thu, 27 Jul 2017 11:37:15 +0100 Subject: [PATCH] Allow ansible.cfg overrides (#27372) If a cfg file exists for this this command then use it. This allows versioned test configuration to override the built in Ansible constants. --- test/integration/network-integration.cfg | 5 +++++ test/runner/lib/ansible_util.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/integration/network-integration.cfg diff --git a/test/integration/network-integration.cfg b/test/integration/network-integration.cfg new file mode 100644 index 0000000000..5d4c9fbbc0 --- /dev/null +++ b/test/integration/network-integration.cfg @@ -0,0 +1,5 @@ +# NOTE: This file is used by ansible-test to override specific Ansible constants +# This file is used by `ansible-test network-integration` + +[defaults] +timeout = 60 diff --git a/test/runner/lib/ansible_util.py b/test/runner/lib/ansible_util.py index 6eb3608eec..2cd7013fd8 100644 --- a/test/runner/lib/ansible_util.py +++ b/test/runner/lib/ansible_util.py @@ -21,10 +21,14 @@ def ansible_environment(args, color=True): if not path.startswith(ansible_path + os.pathsep): path = ansible_path + os.pathsep + path + ansible_config = '/dev/null' + if os.path.isfile('test/integration/%s.cfg' % args.command): + ansible_config = os.path.abspath('test/integration/%s.cfg' % args.command) + ansible = dict( ANSIBLE_FORCE_COLOR='%s' % 'true' if args.color and color else 'false', ANSIBLE_DEPRECATION_WARNINGS='false', - ANSIBLE_CONFIG='/dev/null', + ANSIBLE_CONFIG=ansible_config, ANSIBLE_HOST_KEY_CHECKING='false', PYTHONPATH=os.path.abspath('lib'), PAGER='/bin/cat',