From a018ba4013ad18eb75bdfd50887ef12ad2d77972 Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Wed, 11 Jan 2012 10:07:03 +0100 Subject: [PATCH 3/3] Prevent service restart failures in ipa-replica-install Call restart() methods of appropriate services instead of calling the system service restart command directly as service() method has a capability to wait until the service is fully up. Without this patch ipa-replica-install crashed on F-16 because krb5kdc service was started before dirsrv service was fully up. https://fedorahosted.org/freeipa/ticket/2139 --- install/tools/ipa-replica-install | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install index 7310d286292f571ef25b57b29d2a213f4bd855a1..9c637202917fc67da68cea61ebc1b41169bbf2db 100755 --- a/install/tools/ipa-replica-install +++ b/install/tools/ipa-replica-install @@ -155,6 +155,8 @@ def install_krb(config, setup_pkinit=False): ldappwd_filename, kpasswd_filename, setup_pkinit, pkcs12_info) + return krb + def install_ca_cert(config): cafile = config.dir + "/ca.crt" if not ipautil.file_exists(cafile): @@ -188,6 +190,8 @@ def install_http(config, auto_redirect): print "error copying files: " + str(e) sys.exit(1) + return http + def install_bind(config, options): api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=config.dirman_password) @@ -442,8 +446,8 @@ def main(): cs.add_simple_service('dogtagldap/%s@%s' % (config.host_name, config.realm_name)) cs.add_cert_to_service() - install_krb(config, setup_pkinit=options.setup_pkinit) - install_http(config, auto_redirect=options.ui_redirect) + krb = install_krb(config, setup_pkinit=options.setup_pkinit) + http = install_http(config, auto_redirect=options.ui_redirect) if CA: CA.import_ra_cert(dir + "/ra.p12") CA.fix_ra_perms() @@ -457,9 +461,16 @@ def main(): service.print_msg("Applying LDAP updates") ds.apply_updates() - ipaservices.knownservices.dirsrv.restart() - ipaservices.knownservices.krb5kdc.restart() - ipaservices.knownservices.httpd.restart() + # Restart ds and krb after configurations have been changed + service.print_msg("Restarting the directory server") + ds.restart() + + service.print_msg("Restarting the KDC") + krb.restart() + + # Restart httpd to pick up the new IPA configuration + service.print_msg("Restarting the web server") + http.restart() if options.setup_dns: install_bind(config, options) -- 1.7.7.5