From aa5dc3b417db962a075a092d0d3528010c1059f7 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 21 Apr 2015 18:19:17 -0400 Subject: Use python logging in install / log cherrypy at right severity This replaces the print statements in the installer code with a python logger so we can log all output to the installer log and a subset of it to stdout in one step without duplication. The cherrypy.log.error() logs to the "error" log at a severity of logging.INFO by default. Set an appropriate log level for these as well. https://fedorahosted.org/ipsilon/ticket/35 Signed-off-by: Rob Crittenden Reviewed-by: Simo Sorce --- ipsilon/info/infosssd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ipsilon/info/infosssd.py') diff --git a/ipsilon/info/infosssd.py b/ipsilon/info/infosssd.py index 559469a..69d68c0 100644 --- a/ipsilon/info/infosssd.py +++ b/ipsilon/info/infosssd.py @@ -15,6 +15,7 @@ import cherrypy import time import subprocess import SSSDConfig +import logging SSSD_CONF = '/etc/sssd/sssd.conf' @@ -151,7 +152,7 @@ class Installer(InfoProviderInstaller): except Exception as e: # pylint: disable=broad-except # Unable to read existing SSSD config so it is probably not # configured. - print 'Loading SSSD config failed: %s' % e + logging.info('Loading SSSD config failed: %s', e) return False if not opts['info_sssd_domain']: @@ -163,7 +164,7 @@ class Installer(InfoProviderInstaller): try: sssd_domain = sssdconfig.get_domain(domain) except SSSDConfig.NoDomainError: - print 'No SSSD domain %s' % domain + logging.info('No SSSD domain %s', domain) continue else: sssd_domain.set_option( @@ -171,10 +172,10 @@ class Installer(InfoProviderInstaller): ) sssdconfig.save_domain(sssd_domain) configured += 1 - print "Configured SSSD domain %s" % domain + logging.info("Configured SSSD domain %s", domain) if configured == 0: - print 'No SSSD domains configured' + logging.info('No SSSD domains configured') return False try: -- cgit