[Freeipa-devel] [PATCH] 0129 fix trust.get_dn to distinguish creating and re-adding trusts

Alexander Bokovoy abokovoy at redhat.com
Thu Dec 5 11:51:11 UTC 2013


Latest support for subdomains introduced regression that masked
difference between newly added trust and re-added one.

Additionally, in case no new subdomains were found, the code was
returning None instead of an empty list which later could confuse
trustdomain-find command.

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

-- 
/ Alexander Bokovoy
-------------- next part --------------
>From ee9282a90da3c9802c9d9d8330f3983c479614ac Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy at redhat.com>
Date: Thu, 5 Dec 2013 13:47:37 +0200
Subject: [PATCH 2/2] trust: fix get_dn() to distinguish creating and re-adding
 trusts

Latest support for subdomains introduced regression that masked
difference between newly added trust and re-added one.

Additionally, in case no new subdomains were found, the code was
returning None instead of an empty list which later could confuse
trustdomain-find command.

https://fedorahosted.org/freeipa/ticket/4067
---
 ipalib/plugins/trust.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipalib/plugins/trust.py b/ipalib/plugins/trust.py
index 3b1b2fc..76d609f 100644
--- a/ipalib/plugins/trust.py
+++ b/ipalib/plugins/trust.py
@@ -262,7 +262,7 @@ class trust(LDAPObject):
                 result = ldap.get_entries(DN(self.container_dn, self.env.basedn),
                                           ldap.SCOPE_SUBTREE, filter, [''])
             except errors.NotFound:
-                trust_type = u'ad'
+                return None
             else:
                 if len(result) > 1:
                     raise errors.OnlyOneValueAllowed(attr='trust domain')
@@ -1244,7 +1244,7 @@ def fetch_domains_from_trust(self, trustinstance, trust_entry, **options):
                                              trust_name, creds=creds)
     result = []
     if not domains:
-        return None
+        return result
 
     for dom in domains:
         dom['trust_type'] = u'ad'
-- 
1.8.4.2



More information about the Freeipa-devel mailing list