diff options
author | Martin Basti <mbasti@redhat.com> | 2015-04-15 15:06:45 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2015-04-24 15:39:08 +0200 |
commit | 2c8c4b8c885fe34cc722cce91639230a7734c3f3 (patch) | |
tree | 81c3c7b06ca77daa9a66edfe309fce8ad1a8121d | |
parent | e55d8ee5d4649b2fd35aa6f29ed2a8f60088d1a8 (diff) | |
download | freeipa-2c8c4b8c885fe34cc722cce91639230a7734c3f3.tar.gz freeipa-2c8c4b8c885fe34cc722cce91639230a7734c3f3.tar.xz freeipa-2c8c4b8c885fe34cc722cce91639230a7734c3f3.zip |
ipa client: use NTP servers specified by user
NTP servers specified by user should be used to synchronize time.
https://fedorahosted.org/freeipa/ticket/4983
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
-rwxr-xr-x | ipa-client/ipa-install/ipa-client-install | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index 43d5ae8dc..083bcf3ec 100755 --- a/ipa-client/ipa-install/ipa-client-install +++ b/ipa-client/ipa-install/ipa-client-install @@ -2350,19 +2350,25 @@ def install(options, env, fstore, statestore): ntp_srv_servers = ds.ipadns_search_srv(cli_domain, '_ntp._udp', None, break_on_first=False) synced_ntp = False - if ntp_srv_servers: - for s in ntp_srv_servers: - synced_ntp = ipaclient.ntpconf.synconce_ntp(s) - if synced_ntp: - break - if not synced_ntp: + ntp_servers = ntp_srv_servers + + # use user specified NTP servers if there are any + if options.ntp_servers: + ntp_servers = options.ntp_servers + + for s in ntp_servers: + synced_ntp = ipaclient.ntpconf.synconce_ntp(s) + if synced_ntp: + break + + if not synced_ntp and not options.ntp_servers: synced_ntp = ipaclient.ntpconf.synconce_ntp(cli_server[0]) if not synced_ntp: - root_logger.warning("Unable to sync time with IPA NTP " + + root_logger.warning("Unable to sync time with NTP " + "server, assuming the time is in sync. Please check " + "that 123 UDP port is opened.") else: - root_logger.info('Skipping synchronizing time with IPA NTP server.') + root_logger.info('Skipping synchronizing time with NTP server.') if not options.unattended: if (options.principal is None and options.password is None and @@ -2854,7 +2860,7 @@ def install(options, env, fstore, statestore): if options.force_ntpd: ipaclient.ntpconf.force_ntpd(statestore) - if options.ntp_server: + if options.ntp_servers: ntp_servers = options.ntp_servers elif ntp_srv_servers: ntp_servers = ntp_srv_servers |