diff options
author | Alexander Bokovoy <abokovoy@redhat.com> | 2011-10-04 13:56:12 +0300 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-10-05 12:52:40 +0200 |
commit | f93d71409aa78c4e5c860405cdcc3bc6ffc49280 (patch) | |
tree | 63b21285863e5f7e3fbd1f70ef5fdf53ca18e71d /ipa-client/ipa-install | |
parent | 12bfed37d4d22319e2cfadb5d9b460da7e748432 (diff) | |
download | freeipa-f93d71409aa78c4e5c860405cdcc3bc6ffc49280.tar.gz freeipa-f93d71409aa78c4e5c860405cdcc3bc6ffc49280.tar.xz freeipa-f93d71409aa78c4e5c860405cdcc3bc6ffc49280.zip |
Setup and restore ntp configuration on the client side properly
When setting up the client-side NTP configuration, make sure that /etc/ntp/step-tickers
point to IPA NTP server as well.
When restoring the client during ipa-client-install --uninstall, make sure NTP configuration
is fully restored and NTP service is disabled if it was disabled before the installation.
https://fedorahosted.org/freeipa/ticket/1770
Diffstat (limited to 'ipa-client/ipa-install')
-rwxr-xr-x | ipa-client/ipa-install/ipa-client-install | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index 8e12d05fd..985abe06d 100755 --- a/ipa-client/ipa-install/ipa-client-install +++ b/ipa-client/ipa-install/ipa-client-install @@ -320,6 +320,30 @@ def uninstall(options, env, quiet=False): # this is optional service, just log logging.info("%s daemon is not installed, skip configuration" % (nslcd.service_name)) + ntp_configured = statestore.has_state('ntp') + if ntp_configured: + ntp_enabled = statestore.restore_state('ntp', 'enabled') + ntp_step_tickers = statestore.restore_state('ntp', 'step-tickers') + + try: + # Restore might fail due to file missing in backup + # the reason for it might be that freeipa-client was updated + # to this version but not unenrolled/enrolled again + # In such case it is OK to fail + restored = fstore.restore_file("/etc/ntp.conf") + restored |= fstore.restore_file("/etc/sysconfig/ntpd") + if ntp_step_tickers: + restored |= fstore.restore_file("/etc/ntp/step-tickers") + except: + pass + + if not ntp_enabled: + ipaservices.knownservices.ntpd.stop() + ipaservices.knownservices.ntpd.disable() + else: + if restored: + ipaservices.knownservices.ntpd.restart() + if not options.unattended: emit_quiet(quiet, "The original nsswitch.conf configuration has been restored.") emit_quiet(quiet, "You may need to restart services or reboot the machine.") @@ -1103,7 +1127,7 @@ def install(options, env, fstore, statestore): ntp_server = options.ntp_server else: ntp_server = cli_server - ipaclient.ntpconf.config_ntp(ntp_server, fstore) + ipaclient.ntpconf.config_ntp(ntp_server, fstore, statestore) print "NTP enabled" print "Client configuration complete." |