URL: https://github.com/freeipa/freeipa/pull/833
Author: Tiboris
 Title: #833: Fixes traceback in log and corrects console output
Action: opened

PR body:
"""
There was traceback in error_log, when running trustdomain-find
command for trusted child domain and it results into ERROR.
Correct behavior is to show 0 entries found.

Fixes https://pagure.io/freeipa/issue/6477
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/833/head:pr833
git checkout pr833
From a032d9091f04d2896a6347834d88fb749f889555 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdud...@redhat.com>
Date: Fri, 26 May 2017 14:58:37 +0200
Subject: [PATCH] Fixes traceback in log and corrects console output

There was traceback in error_log, when running trustdomain-find
command for trusted child domain and it results into ERROR.
Correct behavior is to show 0 entries found.

Fixes https://pagure.io/freeipa/issue/6477
---
 ipaserver/plugins/baseldap.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ipaserver/plugins/baseldap.py b/ipaserver/plugins/baseldap.py
index a6fc88b591..4e544749da 100644
--- a/ipaserver/plugins/baseldap.py
+++ b/ipaserver/plugins/baseldap.py
@@ -2007,7 +2007,14 @@ def execute(self, *args, **options):
         except IndexError:
             term = None
         if self.obj.parent_object:
-            base_dn = self.api.Object[self.obj.parent_object].get_dn(*keys)
+            try:
+                base_dn = self.api.Object[self.obj.parent_object].get_dn(*keys)
+            except errors.NotFound:
+                return {
+                    'result': [],
+                    'count': 0,
+                    'truncated': False,
+                }
         else:
             base_dn = DN(self.obj.container_dn, api.env.basedn)
         assert isinstance(base_dn, DN)
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to