summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2015-12-08 10:12:32 -0500
committerBrenton Leanhardt <bleanhar@redhat.com>2015-12-08 10:12:51 -0500
commit62ab67626448edfbf70fd862de0324a8c7252a13 (patch)
tree38c21990f188559169dfbf42a4c4f2cbb1ef5e82 /utils
parent3363ce041ae9543e148d3b53887c6b95100dfd67 (diff)
downloadopenshift-62ab67626448edfbf70fd862de0324a8c7252a13.tar.gz
openshift-62ab67626448edfbf70fd862de0324a8c7252a13.tar.bz2
openshift-62ab67626448edfbf70fd862de0324a8c7252a13.tar.xz
openshift-62ab67626448edfbf70fd862de0324a8c7252a13.zip
Bug 1287977 - Incorrect check output from atomic-openshift-installer when working with preconfigured load balancer
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/oo_config.py10
-rw-r--r--utils/test/cli_installer_tests.py57
2 files changed, 65 insertions, 2 deletions
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py
index 1be85bc1d..031b82bc1 100644
--- a/utils/src/ooinstall/oo_config.py
+++ b/utils/src/ooinstall/oo_config.py
@@ -14,7 +14,8 @@ PERSIST_SETTINGS = [
'variant_version',
'version',
]
-REQUIRED_FACTS = ['ip', 'public_ip', 'hostname', 'public_hostname']
+DEFAULT_REQUIRED_FACTS = ['ip', 'public_ip', 'hostname', 'public_hostname']
+PRECONFIGURED_REQUIRED_FACTS = ['hostname', 'public_hostname']
class OOConfigFileError(Exception):
@@ -208,7 +209,12 @@ class OOConfig(object):
for host in self.hosts:
missing_facts = []
- for required_fact in REQUIRED_FACTS:
+ if host.preconfigured:
+ required_facts = PRECONFIGURED_REQUIRED_FACTS
+ else:
+ required_facts = DEFAULT_REQUIRED_FACTS
+
+ for required_fact in required_facts:
if not getattr(host, required_fact):
missing_facts.append(required_fact)
if len(missing_facts) > 0:
diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py
index d028bf472..1da49c807 100644
--- a/utils/test/cli_installer_tests.py
+++ b/utils/test/cli_installer_tests.py
@@ -225,6 +225,44 @@ hosts:
master: true
"""
+QUICKHA_CONFIG_PRECONFIGURED_LB = """
+variant: %s
+ansible_ssh_user: root
+hosts:
+ - connect_to: 10.0.0.1
+ ip: 10.0.0.1
+ hostname: master-private.example.com
+ public_ip: 24.222.0.1
+ public_hostname: master.example.com
+ master: true
+ node: true
+ - connect_to: 10.0.0.2
+ ip: 10.0.0.2
+ hostname: node1-private.example.com
+ public_ip: 24.222.0.2
+ public_hostname: node1.example.com
+ master: true
+ node: true
+ - connect_to: 10.0.0.3
+ ip: 10.0.0.3
+ hostname: node2-private.example.com
+ public_ip: 24.222.0.3
+ public_hostname: node2.example.com
+ node: true
+ master: true
+ - connect_to: 10.0.0.4
+ ip: 10.0.0.4
+ hostname: node3-private.example.com
+ public_ip: 24.222.0.4
+ public_hostname: node3.example.com
+ node: true
+ - connect_to: proxy-private.example.com
+ hostname: proxy-private.example.com
+ public_hostname: proxy.example.com
+ master_lb: true
+ preconfigured: true
+"""
+
class UnattendedCliTests(OOCliFixture):
def setUp(self):
@@ -608,6 +646,25 @@ class UnattendedCliTests(OOCliFixture):
# This is not a valid configuration:
self.assert_result(result, 1)
+ #unattended with preconfigured lb
+ @patch('ooinstall.openshift_ansible.run_main_playbook')
+ @patch('ooinstall.openshift_ansible.load_system_facts')
+ def test_quick_ha_preconfigured_lb(self, load_facts_mock, run_playbook_mock):
+ load_facts_mock.return_value = (MOCK_FACTS_QUICKHA, 0)
+ run_playbook_mock.return_value = 0
+
+ config_file = self.write_config(os.path.join(self.work_dir,
+ 'ooinstall.conf'), QUICKHA_CONFIG_PRECONFIGURED_LB % 'openshift-enterprise')
+
+ self.cli_args.extend(["-c", config_file, "install"])
+ result = self.runner.invoke(cli.cli, self.cli_args)
+ self.assert_result(result, 0)
+
+ # Make sure we ran on the expected masters and nodes:
+ hosts = run_playbook_mock.call_args[0][0]
+ hosts_to_run_on = run_playbook_mock.call_args[0][1]
+ self.assertEquals(5, len(hosts))
+ self.assertEquals(5, len(hosts_to_run_on))
class AttendedCliTests(OOCliFixture):