If for some reason the managed entries definitions don't exist ipa-managed-entries -l will raise a nasty traceback. This will catch it and show a error.

I think this was caused by a past update problem. I don't think it is an issue any more but it is worthwhile to add a try/except around this search.

rob
>From 00e49c5091a2e1b20f9ee01d47aa3a79067c9830 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Thu, 12 Jan 2012 18:27:08 -0500
Subject: [PATCH] Catch exception when trying to list missing managed entries
 definitions

On the off chance that the definitions cannot be found we should
catch the error and not raise a backtrace.

https://fedorahosted.org/freeipa/ticket/1912
---
 install/tools/ipa-managed-entries |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/install/tools/ipa-managed-entries b/install/tools/ipa-managed-entries
index f3473e2..e085388 100755
--- a/install/tools/ipa-managed-entries
+++ b/install/tools/ipa-managed-entries
@@ -127,9 +127,13 @@ def main():
     if options.list_managed_entries:
         # List available Managed Entry Plugins
         managed_entries = None
-        entries = conn.search_s(
-            managed_entry_definitions_dn, ldap.SCOPE_SUBTREE, filter
-            )
+        try:
+            entries = conn.search_s(
+                managed_entry_definitions_dn, ldap.SCOPE_SUBTREE, filter
+                )
+        except Exception, e:
+            root_logger.debug("Search for managed entries failed: %s" % str(e))
+            sys.exit("Unable to find managed entries at %s" % managed_entry_definitions_dn)
         managed_entries = [entry.cn for entry in entries]
         if managed_entries:
             print "Available Managed Entry Definitions:"
-- 
1.7.6

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

Reply via email to