diff options
author | John Dennis <jdennis@redhat.com> | 2012-04-16 18:48:57 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-04-16 22:26:59 -0400 |
commit | 36eb2543c3c01a24a6604b761b7287ae179cea7e (patch) | |
tree | 3ab36bcc626377bf682daec19cad99f41d68c3fd | |
parent | bd84fb445845bffc03109f3c69201c45da46fd48 (diff) | |
download | freeipa.git-36eb2543c3c01a24a6604b761b7287ae179cea7e.tar.gz freeipa.git-36eb2543c3c01a24a6604b761b7287ae179cea7e.tar.xz freeipa.git-36eb2543c3c01a24a6604b761b7287ae179cea7e.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.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py index 89076f64..74cdd6ce 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): |