diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2015-11-16 12:03:47 -0400 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2015-11-16 12:03:47 -0400 |
commit | 037950923abd5188977e825d994f14111b0e6a89 (patch) | |
tree | 42fec834dc8b8cd7f9bc1ed2f77402ec87200cc2 | |
parent | f33f2d789c58e334449060ce532d7a2785f79e7c (diff) | |
download | openshift-037950923abd5188977e825d994f14111b0e6a89.tar.gz openshift-037950923abd5188977e825d994f14111b0e6a89.tar.bz2 openshift-037950923abd5188977e825d994f14111b0e6a89.tar.xz openshift-037950923abd5188977e825d994f14111b0e6a89.zip |
Fix tests on systems with openshift-ansible rpms installed.
-rw-r--r-- | utils/src/ooinstall/cli_installer.py | 3 | ||||
-rw-r--r-- | utils/test/cli_installer_tests.py | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 3c3f45c3b..3b5dbaf0e 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -458,7 +458,8 @@ def cli(ctx, unattended, configuration, ansible_playbook_directory, ansible_conf if ctx.obj['ansible_config']: oo_cfg.settings['ansible_config'] = ctx.obj['ansible_config'] - elif os.path.exists(DEFAULT_ANSIBLE_CONFIG): + elif 'ansible_config' not in oo_cfg.settings and \ + os.path.exists(DEFAULT_ANSIBLE_CONFIG): # If we're installed by RPM this file should exist and we can use it as our default: oo_cfg.settings['ansible_config'] = DEFAULT_ANSIBLE_CONFIG diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py index fc16d9ceb..baadad358 100644 --- a/utils/test/cli_installer_tests.py +++ b/utils/test/cli_installer_tests.py @@ -284,7 +284,9 @@ class UnattendedCliTests(OOCliFixture): '.ansible/callback_facts.yaml'), env_vars['OO_INSTALL_CALLBACK_FACTS_YAML']) self.assertEqual('/tmp/ansible.log', env_vars['ANSIBLE_LOG_PATH']) - self.assertTrue('ANSIBLE_CONFIG' not in env_vars) + # If user running test has rpm installed, this might be set to default: + self.assertTrue('ANSIBLE_CONFIG' not in env_vars or + env_vars['ANSIBLE_CONFIG'] == cli.DEFAULT_ANSIBLE_CONFIG) # Make sure we ran on the expected masters and nodes: hosts = run_playbook_mock.call_args[0][0] @@ -450,14 +452,18 @@ class UnattendedCliTests(OOCliFixture): if expected_result: self.assertEquals(expected_result, facts_env_vars['ANSIBLE_CONFIG']) else: - self.assertFalse('ANSIBLE_CONFIG' in facts_env_vars) + # If user running test has rpm installed, this might be set to default: + self.assertTrue('ANSIBLE_CONFIG' not in facts_env_vars or + facts_env_vars['ANSIBLE_CONFIG'] == cli.DEFAULT_ANSIBLE_CONFIG) # Test the env vars for main playbook: env_vars = run_ansible_mock.call_args[0][2] if expected_result: self.assertEquals(expected_result, env_vars['ANSIBLE_CONFIG']) else: - self.assertFalse('ANSIBLE_CONFIG' in env_vars) + # If user running test has rpm installed, this might be set to default: + self.assertTrue('ANSIBLE_CONFIG' not in env_vars or + env_vars['ANSIBLE_CONFIG'] == cli.DEFAULT_ANSIBLE_CONFIG) class AttendedCliTests(OOCliFixture): |