diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2013-02-19 22:29:10 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2013-02-19 22:56:29 -0500 |
commit | 6668f3b43e17869adc18ed7c1ade7ce3c4ba0d73 (patch) | |
tree | be19d2eb08deaa2ba4daa48347879872519af242 /base/deploy/src/pkispawn | |
parent | f49c98ca0cbfc0def8f055c2d97c031ff0f4a439 (diff) | |
download | pki-ticket-472.tar.gz pki-ticket-472.tar.xz pki-ticket-472.zip |
Added DS info validation.ticket-472
The installer script has been modified to validate DS info in both
interactive and silent installation.
Ticket #472
Diffstat (limited to 'base/deploy/src/pkispawn')
-rwxr-xr-x | base/deploy/src/pkispawn | 67 |
1 files changed, 59 insertions, 8 deletions
diff --git a/base/deploy/src/pkispawn b/base/deploy/src/pkispawn index f03bc15a1..509f08e4e 100755 --- a/base/deploy/src/pkispawn +++ b/base/deploy/src/pkispawn @@ -27,6 +27,7 @@ if not hasattr(sys, "hexversion") or sys.hexversion < 0x020700f0: sys.exit(1) try: import argparse + import ldap import logging import os import socket @@ -176,13 +177,46 @@ def main(argv): print print "Directory Server:" - parser.read_text('Hostname', config.pki_subsystem, 'pki_ds_hostname') - parser.read_text('Port', config.pki_subsystem, 'pki_ds_ldap_port') - parser.read_text('Base DN', config.pki_subsystem, 'pki_ds_base_dn') - parser.read_text('Bind DN', config.pki_subsystem, 'pki_ds_bind_dn') - parser.read_password( - 'Password', config.pki_subsystem, 'pki_ds_password', - verifyMessage='Verify password') + while True: + parser.read_text('Hostname', config.pki_subsystem, 'pki_ds_hostname') + parser.read_text('Port', config.pki_subsystem, 'pki_ds_ldap_port') + + try: + parser.ds_connect() + break + + except ldap.LDAPError as e: + parser.print_text('ERROR: ' + e.message['desc']) + + while True: + parser.read_text('Bind DN', config.pki_subsystem, 'pki_ds_bind_dn') + parser.read_password('Password', config.pki_subsystem, 'pki_ds_password') + + try: + parser.ds_bind() + break + + except ldap.LDAPError as e: + parser.print_text('ERROR: ' + e.message['desc']) + + while True: + parser.read_text('Base DN', config.pki_subsystem, 'pki_ds_base_dn') + if not parser.ds_base_dn_exists(): + break + + remove = parser.read_text('Base DN already exists. Overwrite (Yes/No/Quit)', + options=['Yes', 'Y', 'No', 'N', 'Quit', 'Q'], + sign='?', allowEmpty=False, caseSensitive=False).lower() + + if remove == 'q' or remove == 'quit': + print "Installation canceled." + sys.exit(0) + + if remove == 'y' or remove == 'yes': + break + + parser.ds_close() + print print "Security Domain:" @@ -210,7 +244,7 @@ def main(argv): print "Installation canceled." sys.exit(0) - elif begin == 'y' or begin == 'yes': + if begin == 'y' or begin == 'yes': break else: @@ -282,6 +316,23 @@ def main(argv): config.pki_log.debug(pkilogging.format(config.pki_master_dict), extra=config.PKI_INDENTATION_LEVEL_0) + if not interactive: + try: + if not config.str2bool(config.pki_master_dict['pki_skip_configuration']): + parser.ds_connect() + parser.ds_bind() + + if parser.ds_base_dn_exists() and\ + not config.str2bool(config.pki_master_dict['pki_ds_remove_data']): + print 'ERROR: Base DN already exists.' + sys.exit(1) + + parser.ds_close() + + except ldap.LDAPError as e: + print 'ERROR: ' + e.message['desc'] + sys.exit(1) + print "Installing " + config.pki_subsystem + " into " + config.pki_master_dict['pki_instance_path'] + "." # Process the various "scriptlets" to create the specified PKI subsystem. |