diff options
author | Rob Crittenden <rcritten@redhat.com> | 2012-01-30 16:29:32 -0500 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-02-29 15:28:13 +0100 |
commit | e889b82599ddd939ed2a65b0011d5807c587cf05 (patch) | |
tree | 79a31529aba2a25bdb60d94c670d2b7caa20823e /ipapython | |
parent | 37cdbae23424b0dd8c6296d0303efdfa3bfffcfd (diff) | |
download | freeipa-e889b82599ddd939ed2a65b0011d5807c587cf05.tar.gz freeipa-e889b82599ddd939ed2a65b0011d5807c587cf05.tar.xz freeipa-e889b82599ddd939ed2a65b0011d5807c587cf05.zip |
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
Diffstat (limited to 'ipapython')
-rw-r--r-- | ipapython/ipautil.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 20f7578ce..416ebf5f3 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -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: |