mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add support defaultNamingContext and add --basedn to migrate-ds
There are two sides to this, the server and client side. On the server side we attempt to add a defaultNamingContext on already installed servers. This will fail on older 389-ds instances but the failure is not fatal. New installations on versions of 389-ds that support this attribute will have it already defined. On the client side we need to look for both defaultNamingContext and namingContexts. We still need to check that the defaultNamingContext is an IPA server (info=IPAV2). The migration change also takes advantage of this and adds a new option which allows one to provide a basedn to use instead of trying to detect it. https://fedorahosted.org/freeipa/ticket/1919 https://fedorahosted.org/freeipa/ticket/2314
This commit is contained in:
committed by
Martin Kosek
parent
37cdbae234
commit
e889b82599
@@ -1191,10 +1191,16 @@ def get_ipa_basedn(conn):
|
||||
:param conn: Bound LDAP connection that will be used for searching
|
||||
"""
|
||||
entries = conn.search_ext_s(
|
||||
'', scope=ldap.SCOPE_BASE, attrlist=['namingcontexts']
|
||||
'', scope=ldap.SCOPE_BASE, attrlist=['defaultnamingcontext', 'namingcontexts']
|
||||
)
|
||||
|
||||
contexts = entries[0][1]['namingcontexts']
|
||||
if entries[0][1].get('defaultnamingcontext'):
|
||||
# If there is a defaultNamingContext examine that one first
|
||||
default = entries[0][1]['defaultnamingcontext'][0]
|
||||
if default in contexts:
|
||||
contexts.remove(default)
|
||||
contexts.insert(0, entries[0][1]['defaultnamingcontext'][0])
|
||||
for context in contexts:
|
||||
root_logger.debug("Check if naming context '%s' is for IPA" % context)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user