From 6048cad5a65481f3716061c574a853f2391b11c2 Mon Sep 17 00:00:00 2001 From: Valeriy Ponomaryov Date: Tue, 2 Jan 2018 17:06:56 +0530 Subject: [PATCH] [VMWare] Fix oauth config for OCP installation For the moment, oauthConfig configuration for OCP supports two values 'ldap' and 'none' (allow all passwords). And the latter one is broken. Fix it and exit with error early in case we have improper value for "auth_type" config option. --- .../vmware-ansible/ocp-on-vmware.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/reference-architecture/vmware-ansible/ocp-on-vmware.py b/reference-architecture/vmware-ansible/ocp-on-vmware.py index b4d6511a6..ac0a07573 100755 --- a/reference-architecture/vmware-ansible/ocp-on-vmware.py +++ b/reference-architecture/vmware-ansible/ocp-on-vmware.py @@ -481,7 +481,16 @@ def _create_ocp_vars(self): if not self.no_confirm: click.confirm('Continue using these values?', abort=True) - if self.auth_type == 'ldap': + if self.auth_type == 'none': + playbooks = ["playbooks/ocp-install.yaml", "playbooks/minor-update.yaml"] + for ocp_file in playbooks: + for line in fileinput.input(ocp_file, inplace=True): + if line.startswith('#openshift_master_identity_providers:'): + line = line.replace('#', ' ') + print line + else: + print line, + elif self.auth_type == 'ldap': l_bdn = "" for d in self.ldap_fqdn.split("."): @@ -550,15 +559,11 @@ def _create_ocp_vars(self): else: print line, - if self.auth_type == 'none': - playbooks = ["playbooks/ocp-install.yaml", "playbooks/minor-update.yaml"] - for ocp_file in playbooks: - for line in fileinput.input(ocp_file, inplace=True): - if line.startswith('#openshift_master_identity_providers:'): - line = line.replace('#', ' ') - print line - else: - print line, + else: + print ("'auth_type' configuration has improper value '%s'. " + "It is allowed to be either " + "'ldap' or 'none'." % self.auth_type) + exit(1) if self.args.create_ocp_vars: exit(0)