|
|
590d18 |
From 941941733a9a2af27ae4fd73714a87a08931e76a Mon Sep 17 00:00:00 2001
|
|
|
590d18 |
From: Martin Babinsky <mbabinsk@redhat.com>
|
|
|
590d18 |
Date: Mon, 30 Mar 2015 12:29:04 +0200
|
|
|
590d18 |
Subject: [PATCH] enable debugging of ntpd during client installation
|
|
|
590d18 |
|
|
|
590d18 |
When installing IPA client in debug mode, the ntpd command spawned during
|
|
|
590d18 |
initial time-sync with master KDC will also run in debug mode.
|
|
|
590d18 |
|
|
|
590d18 |
https://fedorahosted.org/freeipa/ticket/4931
|
|
|
590d18 |
|
|
|
590d18 |
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
|
|
|
590d18 |
Reviewed-By: Martin Basti <mbasti@redhat.com>
|
|
|
590d18 |
---
|
|
|
590d18 |
ipa-client/ipa-install/ipa-client-install | 5 +++--
|
|
|
590d18 |
ipa-client/ipaclient/ntpconf.py | 7 +++++--
|
|
|
590d18 |
2 files changed, 8 insertions(+), 4 deletions(-)
|
|
|
590d18 |
|
|
|
590d18 |
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
|
|
|
590d18 |
index a1564583ca2d461413da7ea5929b91851cd3f3e1..96b30b486585bc60b0882263cff58292a3538df9 100755
|
|
|
590d18 |
--- a/ipa-client/ipa-install/ipa-client-install
|
|
|
590d18 |
+++ b/ipa-client/ipa-install/ipa-client-install
|
|
|
590d18 |
@@ -2388,12 +2388,13 @@ def install(options, env, fstore, statestore):
|
|
|
590d18 |
ntp_servers = options.ntp_servers
|
|
|
590d18 |
|
|
|
590d18 |
for s in ntp_servers:
|
|
|
590d18 |
- synced_ntp = ipaclient.ntpconf.synconce_ntp(s)
|
|
|
590d18 |
+ synced_ntp = ipaclient.ntpconf.synconce_ntp(s, options.debug)
|
|
|
590d18 |
if synced_ntp:
|
|
|
590d18 |
break
|
|
|
590d18 |
|
|
|
590d18 |
if not synced_ntp and not options.ntp_servers:
|
|
|
590d18 |
- synced_ntp = ipaclient.ntpconf.synconce_ntp(cli_server[0])
|
|
|
590d18 |
+ synced_ntp = ipaclient.ntpconf.synconce_ntp(cli_server[0],
|
|
|
590d18 |
+ options.debug)
|
|
|
590d18 |
if not synced_ntp:
|
|
|
590d18 |
root_logger.warning("Unable to sync time with NTP " +
|
|
|
590d18 |
"server, assuming the time is in sync. Please check " +
|
|
|
590d18 |
diff --git a/ipa-client/ipaclient/ntpconf.py b/ipa-client/ipaclient/ntpconf.py
|
|
|
590d18 |
index c22fba401d33009b3b95d1418dc7c8a03328d569..9a7db6544b54288569dc7699e67ddc865bb88db4 100644
|
|
|
590d18 |
--- a/ipa-client/ipaclient/ntpconf.py
|
|
|
590d18 |
+++ b/ipa-client/ipaclient/ntpconf.py
|
|
|
590d18 |
@@ -137,7 +137,7 @@ def config_ntp(ntp_servers, fstore = None, sysstore = None):
|
|
|
590d18 |
services.knownservices.ntpd.restart()
|
|
|
590d18 |
|
|
|
590d18 |
|
|
|
590d18 |
-def synconce_ntp(server_fqdn):
|
|
|
590d18 |
+def synconce_ntp(server_fqdn, debug=False):
|
|
|
590d18 |
"""
|
|
|
590d18 |
Syncs time with specified server using ntpd.
|
|
|
590d18 |
Primarily designed to be used before Kerberos setup
|
|
|
590d18 |
@@ -150,13 +150,16 @@ def synconce_ntp(server_fqdn):
|
|
|
590d18 |
return False
|
|
|
590d18 |
|
|
|
590d18 |
tmp_ntp_conf = ipautil.write_tmp_file('server %s' % server_fqdn)
|
|
|
590d18 |
+ args = [ntpd, '-qgc', tmp_ntp_conf.name]
|
|
|
590d18 |
+ if debug:
|
|
|
590d18 |
+ args.append('-d')
|
|
|
590d18 |
try:
|
|
|
590d18 |
# The ntpd command will never exit if it is unable to reach the
|
|
|
590d18 |
# server, so timeout after 15 seconds.
|
|
|
590d18 |
timeout = 15
|
|
|
590d18 |
root_logger.info('Attempting to sync time using ntpd. '
|
|
|
590d18 |
'Will timeout after %d seconds' % timeout)
|
|
|
590d18 |
- ipautil.run([ntpd, '-qgc', tmp_ntp_conf.name], timeout=timeout)
|
|
|
590d18 |
+ ipautil.run(args, timeout=timeout)
|
|
|
590d18 |
return True
|
|
|
590d18 |
except ipautil.CalledProcessError:
|
|
|
590d18 |
return False
|
|
|
590d18 |
--
|
|
|
590d18 |
2.4.3
|
|
|
590d18 |
|