https://fedorahosted.org/freeipa/ticket/4983

Patch attached.

--
Martin Basti

From b17b9342cddc5d0f734101eb4bcaf653f8b7a814 Mon Sep 17 00:00:00 2001
From: Martin Basti <[email protected]>
Date: Wed, 15 Apr 2015 15:06:45 +0200
Subject: [PATCH] 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
---
 ipa-client/ipa-install/ipa-client-install | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 55648bafee6437af6acfcc79c76df22bf0426003..a2e55d9f93ed1e9a3e0a795305caa054bb835f8c 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -2336,19 +2336,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
-- 
2.1.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to