summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2012-04-16 18:48:57 -0400
committerRob Crittenden <rcritten@redhat.com>2012-04-16 22:26:49 -0400
commit72efa64c81fc44dbc05c48730c339120888fecbe (patch)
tree2269d8506c91548711e5a388afbd934298a07633
parentc64bcafa137474cf31cd99e7cd6c28a00add85ff (diff)
downloadfreeipa-72efa64c81fc44dbc05c48730c339120888fecbe.tar.gz
freeipa-72efa64c81fc44dbc05c48730c339120888fecbe.tar.xz
freeipa-72efa64c81fc44dbc05c48730c339120888fecbe.zip
don't append basedn to container if it is included
ticket #2566 When specifying a container to ds-migrate we should not automatically append the basedn if it is provided by the end-user. This is easy to detect using DN objects because DN objects have a endswith() method which can easily and correctly ascertain if a base already exists.
-rw-r--r--ipalib/plugins/migration.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py
index 89076f64d..74cdd6ce2 100644
--- a/ipalib/plugins/migration.py
+++ b/ipalib/plugins/migration.py
@@ -589,13 +589,19 @@ can use their Kerberos accounts.''')
def _get_search_bases(self, options, ds_base_dn, migrate_order):
search_bases = dict()
+ ds_base_dn = DN(ds_base_dn)
for ldap_obj_name in migrate_order:
container = options.get('%scontainer' % to_cli(ldap_obj_name))
if container:
- search_base = str(DN(container, ds_base_dn))
+ container = DN(container)
+ # Don't append base dn if user already appended it in the container dn
+ if container.endswith(ds_base_dn):
+ search_base = container
+ else:
+ search_base = DN(container, ds_base_dn)
else:
search_base = ds_base_dn
- search_bases[ldap_obj_name] = search_base
+ search_bases[ldap_obj_name] = str(search_base)
return search_bases
def migrate(self, ldap, config, ds_ldap, ds_base_dn, options):