From 0b191360ec7d934b582d0c59cd8e377df92438dd Mon Sep 17 00:00:00 2001 From: Samuel Munilla Date: Fri, 20 Nov 2015 15:58:05 -0500 Subject: atomic-openshift-installer: Rename ha_proxy Rename ha_proxy variables and methods to 'master_lb' to better future-proof things. --- utils/src/ooinstall/cli_installer.py | 20 ++++++++++---------- utils/src/ooinstall/oo_config.py | 6 +++--- utils/src/ooinstall/openshift_ansible.py | 2 +- utils/test/cli_installer_tests.py | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'utils') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 01093379f..ac9d884d9 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -115,7 +115,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen num_masters += 1 if num_masters > 1: - hosts.append(collect_ha_proxy()) + hosts.append(collect_master_lb()) if num_masters >= 3 or version == '3.0': masters_set = True @@ -139,7 +139,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen more_hosts = click.confirm('Do you want to add additional hosts?') return hosts -def collect_ha_proxy(): +def collect_master_lb(): """ Get an HA proxy from the user """ @@ -159,10 +159,10 @@ This will also require you to set a third master. host_props['run_on'] = click.confirm('Is this a clean host you want to install HAProxy on?') host_props['master'] = False host_props['node'] = False - host_props['ha_proxy'] = True - ha_proxy = Host(**host_props) + host_props['master_lb'] = True + master_lb = Host(**host_props) - return ha_proxy + return master_lb def confirm_hosts_facts(oo_cfg, callback_facts): hosts = oo_cfg.hosts @@ -237,13 +237,13 @@ def check_hosts_config(oo_cfg): click.clear() masters = [host for host in oo_cfg.hosts if host.master] if len(masters) > 1: - ha_proxy = [host for host in oo_cfg.hosts if host.ha_proxy] - click.echo(ha_proxy) - if len(ha_proxy) > 1: + master_lb = [host for host in oo_cfg.hosts if host.master_lb] + click.echo(master_lb) + if len(master_lb) > 1: click.echo('More than one HAProxy specified. Only one proxy is allowed.') sys.exit(0) - elif len(ha_proxy) == 1: - if ha_proxy[0].master or ha_proxy[0].node: + elif len(master_lb) == 1: + if master_lb[0].master or master_lb[0].node: click.echo('HAProxy is configured as a master or node. Please correct this.') sys.exit(0) else: diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py index 6b4f36204..243a75b09 100644 --- a/utils/src/ooinstall/oo_config.py +++ b/utils/src/ooinstall/oo_config.py @@ -45,7 +45,7 @@ class Host(object): self.node = kwargs.get('node', False) # Should this host run as an HAProxy: - self.ha_proxy = kwargs.get('ha_proxy', False) + self.master_lb = kwargs.get('master_lb', False) self.containerized = kwargs.get('containerized', False) @@ -53,7 +53,7 @@ class Host(object): raise OOConfigInvalidHostError("You must specify either and 'ip' " \ "or 'hostname' to connect to.") - if self.master is False and self.node is False and self.ha_proxy is False: + if self.master is False and self.node is False and self.master_lb is False: raise OOConfigInvalidHostError( "You must specify each host as either a master or a node.") @@ -67,7 +67,7 @@ class Host(object): """ Used when exporting to yaml. """ d = {} for prop in ['ip', 'hostname', 'public_ip', 'public_hostname', - 'master', 'node', 'ha_proxy', 'containerized', 'connect_to', 'run_on']: + 'master', 'node', 'master_lb', 'containerized', 'connect_to', 'run_on']: # If the property is defined (not None or False), export it: if getattr(self, prop): d[prop] = getattr(self, prop) diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py index ff674153d..86c707b17 100644 --- a/utils/src/ooinstall/openshift_ansible.py +++ b/utils/src/ooinstall/openshift_ansible.py @@ -19,7 +19,7 @@ def generate_inventory(hosts): global CFG masters = [host for host in hosts if host.master] nodes = [host for host in hosts if host.node] - proxy = next((host for host in hosts if host.ha_proxy), None) + proxy = next((host for host in hosts if host.master_lb), None) multiple_masters = len(masters) > 1 base_inventory_path = CFG.settings['ansible_inventory_path'] diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py index 9cb44404c..ad00af76f 100644 --- a/utils/test/cli_installer_tests.py +++ b/utils/test/cli_installer_tests.py @@ -155,7 +155,7 @@ hosts: hostname: proxy-private.example.com public_ip: 24.222.0.4 public_hostname: proxy.example.com - ha_proxy: true + master_lb: true """ class OOCliFixture(OOInstallFixture): -- cgit v1.2.3