From 72efa64c81fc44dbc05c48730c339120888fecbe Mon Sep 17 00:00:00 2001 From: John Dennis Date: Mon, 16 Apr 2012 18:48:57 -0400 Subject: 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. --- ipalib/plugins/migration.py | 10 ++++++++-- 1 file 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): -- cgit