pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0156-Use-proper-logging-for-error-messages.patch

ff14fa
From 999042579802d0443307ed18e8bb0b993c102c95 Mon Sep 17 00:00:00 2001
ff14fa
From: Martin Basti <mbasti@redhat.com>
ff14fa
Date: Wed, 18 Jan 2017 17:08:19 +0100
ff14fa
Subject: [PATCH] Use proper logging for error messages
ff14fa
ff14fa
https://fedorahosted.org/freeipa/ticket/6588r
ff14fa
ff14fa
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
ff14fa
---
ff14fa
 ipaserver/install/replication.py | 10 ++++++----
ff14fa
 1 file changed, 6 insertions(+), 4 deletions(-)
ff14fa
ff14fa
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
ff14fa
index be4de6dd0037a028bcaf1743be74a80855ba3541..1f437dad4ed850ebfd59fe9f72a5127df8f56f3e 100644
ff14fa
--- a/ipaserver/install/replication.py
ff14fa
+++ b/ipaserver/install/replication.py
ff14fa
@@ -171,7 +171,7 @@ def wait_for_entry(connection, dn, timeout=7200, attr='', quiet=True):
ff14fa
         except errors.NotFound:
ff14fa
             pass  # no entry yet
ff14fa
         except Exception as e:  # badness
ff14fa
-            print("\nError reading entry", dn, e)
ff14fa
+            root_logger.error("Error reading entry %s: %s", dn, e)
ff14fa
             break
ff14fa
         if not entry:
ff14fa
             if not quiet:
ff14fa
@@ -180,11 +180,13 @@ def wait_for_entry(connection, dn, timeout=7200, attr='', quiet=True):
ff14fa
             time.sleep(1)
ff14fa
 
ff14fa
     if not entry and int(time.time()) > timeout:
ff14fa
-        print("\nwait_for_entry timeout for %s for %s" % (connection, dn))
ff14fa
+        root_logger.error(
ff14fa
+            "wait_for_entry timeout for %s for %s", connection, dn)
ff14fa
     elif entry and not quiet:
ff14fa
-        print("\nThe waited for entry is:", entry)
ff14fa
+        root_logger.error("The waited for entry is: %s", entry)
ff14fa
     elif not entry:
ff14fa
-        print("\nError: could not read entry %s from %s" % (dn, connection))
ff14fa
+        root_logger.error(
ff14fa
+            "Error: could not read entry %s from %s", dn, connection)
ff14fa
 
ff14fa
 
ff14fa
 class ReplicationManager(object):
ff14fa
-- 
ff14fa
2.9.3
ff14fa