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