[Freeipa-devel] [PATCH] 0139 trustdomain_find: make sure we skip short entries when --pkey-only is specified

Alexander Bokovoy abokovoy at redhat.com
Tue Feb 25 17:56:16 UTC 2014


Hi,

Simple patch to fix KeyError as --pkey-only causes no attributes to be
returned and trustdomain_find.post_callback checked them
unconditionally.


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

-- 
/ Alexander Bokovoy
-------------- next part --------------
>From a8540634ddac57ce3c05416b3a08a958b01d99b3 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy at redhat.com>
Date: Tue, 25 Feb 2014 19:47:10 +0200
Subject: [PATCH 2/2] trustdomain_find: make sure we skip short entries when
 --pkey-only is specified

With --pkey-only only primary key is returned. It makes no sense to check and
replace boolean values then.

https://fedorahosted.org/freeipa/ticket/4196
---
 ipalib/plugins/trust.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ipalib/plugins/trust.py b/ipalib/plugins/trust.py
index 5ab4b25..050c468 100644
--- a/ipalib/plugins/trust.py
+++ b/ipalib/plugins/trust.py
@@ -1192,6 +1192,9 @@ class trustdomain_find(LDAPSearch):
         trust_dn = self.obj.get_dn(args[0], trust_type=u'ad')
         trust_entry = ldap.get_entry(trust_dn)
         for entry in entries:
+            if 'ipanttrustedomainsid' not in entry:
+                # --pkey-only case
+                continue
             sid = entry['ipanttrusteddomainsid'][0]
             if sid in trust_entry['ipantsidblacklistincoming']:
                 entry['domain_enabled'] = [False]
-- 
1.8.3.1



More information about the Freeipa-devel mailing list