As I found out when installing on a misconfigured system, we use wrong argument order for NSPRError in nsslib. This patch corrects the problem.


FWIW raising NSPRError might not be correct; the nss.error.NSPRError docstring states:
> Raised internally, there should be no need to raise this exception
> from with a Python program using python-nss.

--
PetrĀ³
From a967f337120c9a691f42e1f9ac8341da2ede396a Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Wed, 21 Aug 2013 10:40:50 +0200
Subject: [PATCH] ipapython.nsslib: Name arguments to NSPRError

Previously NSPRError was given arguments in the wrong order.
Fix this by naming the arguments.
---
 ipapython/nsslib.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py
index fd74dcb747a5e1daf4ef91c3f6cfd69efdc8023c..2fcfd7e092aa36ef7300e73118eb546090f01c2f 100644
--- a/ipapython/nsslib.py
+++ b/ipapython/nsslib.py
@@ -142,9 +142,10 @@ def connect_socket(self, host, port):
         try:
             addr_info = io.AddrInfo(host, family=self.family)
         except Exception:
-             raise NSPRError(error.PR_ADDRESS_NOT_SUPPORTED_ERROR,
-                             "Cannot resolve %s using family %s" % (host,
-                                 io.addr_family_name(self.family)))
+             raise NSPRError(
+                 error_code=error.PR_ADDRESS_NOT_SUPPORTED_ERROR,
+                 error_message="Cannot resolve %s using family %s" % (host,
+                    io.addr_family_name(self.family)))
 
         for net_addr in addr_info:
             root_logger.debug("Connecting: %s", net_addr)
@@ -160,8 +161,9 @@ def connect_socket(self, host, port):
                 root_logger.debug("Try to continue with next family...")
                 continue
 
-        raise NSPRError(error.PR_ADDRESS_NOT_SUPPORTED_ERROR,
-                "Could not connect to %s using any address" % host)
+        raise NSPRError(
+            error_code=error.PR_ADDRESS_NOT_SUPPORTED_ERROR,
+            error_message="Could not connect to %s using any address" % host)
 
 
 class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to