When attempting to detach a private group that doesn't exist, the
error message returned is not consistent with the error returned by
the other topic commands. This patch adds a standard message.

https://fedorahosted.org/freeipa/ticket/291

>From 20639738dbd689839f24775ea4899be3adb8103e Mon Sep 17 00:00:00 2001
From: Martin Kosek <[email protected]>
Date: Wed, 2 Feb 2011 15:29:38 +0100
Subject: [PATCH] Inconsistent error message for ipa group-detach

When attempting to detach a private group that doesn't exist, the
error message returned is not consistent with the error returned by
the other topic commands. This patch adds a standard message.

https://fedorahosted.org/freeipa/ticket/291
---
 ipalib/plugins/group.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py
index 078d535b0de9da543d0202a020e06c642e598b01..b981731e3532fc3eb76520413011613bb2dc9f3e 100644
--- a/ipalib/plugins/group.py
+++ b/ipalib/plugins/group.py
@@ -294,7 +294,10 @@ class group_detach(LDAPQuery):
         group_dn = self.obj.get_dn(*keys, **options)
         user_dn = self.api.Object['user'].get_dn(*keys)
 
-        (user_dn, user_attrs) = ldap.get_entry(user_dn)
+        try:
+            (user_dn, user_attrs) = ldap.get_entry(user_dn)
+        except errors.NotFound:
+            self.obj.handle_not_found(*keys)
         is_managed = self.obj.has_objectclass(user_attrs['objectclass'], 'mepmanagedentry')
         if (not ldap.can_write(user_dn, "objectclass") or
             not (ldap.can_write(user_dn, "mepManagedEntry")) and is_managed):
-- 
1.7.3.5

_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to