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
This commit is contained in:
Alexander Bokovoy 2013-12-05 13:47:37 +02:00 committed by Martin Kosek
parent 71481a0aa4
commit 73e7a6c409

View File

@ -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'