Patch attached, it fixes regression caused by mbasti-442 patch (master only).
From cedddc4cf22fd4ccab44346e4a7472b9d16e390f Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 22 Mar 2016 16:39:39 +0100
Subject: [PATCH] Fix: catch Exception instead of more specific exception types

Regression caused by commit 491447cc5ab8c5eff2be57d609201cefb79f7053,
ValueErrori and AttributeError are too much specific for these cases, multiple types of
exception can be raised.
---
 ipalib/plugins/stageuser.py | 4 ++--
 ipapython/config.py         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ipalib/plugins/stageuser.py b/ipalib/plugins/stageuser.py
index 510b66c43ef3d3b4bbd99637814809c75e15d450..9b40adf1c514e491543ace86ba10630f115a4c57 100644
--- a/ipalib/plugins/stageuser.py
+++ b/ipalib/plugins/stageuser.py
@@ -565,7 +565,7 @@ class stageuser_activate(LDAPQuery):
                     try:
                         v.decode('utf-8')
                         self.log.debug("merge: %s:%r wiped" % (attr, v))
-                    except ValueError:
+                    except Exception:
                         self.log.debug("merge %s: [no_print %s]" % (attr, v.__class__.__name__))
                     if isinstance(entry_to[attr], (list, tuple)):
                         # multi value attribute
@@ -581,7 +581,7 @@ class stageuser_activate(LDAPQuery):
                     try:
                         v.decode('utf-8')
                         self.log.debug("Add: %s:%r" % (attr, v))
-                    except ValueError:
+                    except Exception:
                         self.log.debug("Add %s: [no_print %s]" % (attr, v.__class__.__name__))
 
                     if isinstance(entry_to[attr], (list, tuple)):
diff --git a/ipapython/config.py b/ipapython/config.py
index 0b70d057955f647acd6164895daa15ee96019d54..70afaffa2431271d3a00fdfad6e4d1a3be363f99 100644
--- a/ipapython/config.py
+++ b/ipapython/config.py
@@ -160,7 +160,7 @@ def __parse_config(discover_server = True):
     try:
         if not config.default_realm:
             config.default_realm = p.get("global", "realm")
-    except AttributeError:
+    except Exception:
         pass
     if discover_server:
         try:
@@ -172,7 +172,7 @@ def __parse_config(discover_server = True):
     try:
         if not config.default_domain:
             config.default_domain = p.get("global", "domain")
-    except AttributeError:
+    except Exception:
         pass
 
 def __discover_config(discover_server = True):
-- 
2.5.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to