From 649d13b59746582ee19a7b40e454bc268b1b9be9 Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Wed, 4 Jan 2012 19:53:18 +0100 Subject: 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 file changed, 16 insertions(+), 5 deletions(-) diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install index fd772e571..dcf866202 100755 --- a/install/tools/ipa-replica-install +++ b/install/tools/ipa-replica-install @@ -152,6 +152,8 @@ def install_krb(config, setup_pkinit=False): config.domain_name, config.dirman_password, setup_pkinit, pkcs12_info) + return krb + def install_ca_cert(config): cafile = config.dir + "/ca.crt" if not ipautil.file_exists(cafile): @@ -185,6 +187,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) @@ -420,8 +424,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() @@ -435,9 +439,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) -- cgit