[Pki-devel] [PATCH] 593 Fixed installation logs.

Endi Sukma Dewata edewata at redhat.com
Fri May 8 17:47:19 UTC 2015


To help troubleshooting installation failures the pkihelper.py has
been modified to display the error code returned by the server before
parsing the error message. If there is a parsing error, the unparsed
message will now be displayed.

The redundant 'raise' and 'return' statements have been removed.

-- 
Endi S. Dewata
-------------- next part --------------
From bfbb49ae232f2874f12914ba4a0d700d79ed7956 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata at redhat.com>
Date: Fri, 8 May 2015 01:09:47 -0400
Subject: [PATCH] Fixed installation logs.

To help troubleshooting installation failures the pkihelper.py has
been modified to display the error code returned by the server before
parsing the error message. If there is a parsing error, the unparsed
message will now be displayed.

The redundant 'raise' and 'return' statements have been removed.
---
 base/server/python/pki/server/deployment/pkihelper.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/base/server/python/pki/server/deployment/pkihelper.py b/base/server/python/pki/server/deployment/pkihelper.py
index 4a8398afcdd2d31cc55ec92db7e40636f16ac5ec..1521ef3390c820505b2c5faf044f2c360310243c 100644
--- a/base/server/python/pki/server/deployment/pkihelper.py
+++ b/base/server/python/pki/server/deployment/pkihelper.py
@@ -3693,8 +3693,19 @@ class ConfigClient:
                     self.process_admin_cert(admin_cert)
 
         except Exception, e:
+            config.pki_log.error(
+                log.PKI_CONFIG_JAVA_CONFIGURATION_EXCEPTION + " " + str(e),
+                extra=config.PKI_INDENTATION_LEVEL_2)
+
             if hasattr(e, 'response'):
-                root = ET.fromstring(e.response.text)
+                try:
+                    root = ET.fromstring(e.response.text)
+                except ET.ParseError, pe:
+                    config.pki_log.error(
+                        "ParseError: %s: %s " % (pe, e.response.text),
+                        extra=config.PKI_INDENTATION_LEVEL_2)
+                    raise
+
                 if root.tag == 'PKIException':
                     message = root.findall('.//Message')[0].text
                     if message is not None:
@@ -3702,12 +3713,8 @@ class ConfigClient:
                             log.PKI_CONFIG_JAVA_CONFIGURATION_EXCEPTION + " "
                             + message,
                             extra=config.PKI_INDENTATION_LEVEL_2)
-                        raise
-            config.pki_log.error(
-                log.PKI_CONFIG_JAVA_CONFIGURATION_EXCEPTION + " " + str(e),
-                extra=config.PKI_INDENTATION_LEVEL_2)
+
             raise
-        return
 
     def process_admin_cert(self, admin_cert):
         config.pki_log.debug(
-- 
1.9.3



More information about the Pki-devel mailing list