From ac7ec7909367362047bf6868fa28b8c8528c7dca Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Jan 12 2012 10:46:32 +0000 Subject: 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 --- 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:"