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.

>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

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

 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:"

Freeipa-devel mailing list

Reply via email to