pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone
Blob Blame History Raw
From b196396dad7ef31d98d2937f80b629ecf9489c38 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvoborni@redhat.com>
Date: Mon, 12 Jan 2015 13:08:11 +0100
Subject: [PATCH] migrate-ds: fix compat plugin check

After ACI refactoring, admin cannot read Schema Compatibility plugin configuration and therefore migrade-ds won't find if compat plugin is enabled.

Now the check si done by looking if cn=compat subtree is present.

https://fedorahosted.org/freeipa/ticket/4825

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
---
 ipalib/plugins/migration.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py
index fa3d512bf1434c7d349713f78c292b481021303a..cd1fa73f8f514fa5441bea482199291450c87008 100644
--- a/ipalib/plugins/migration.py
+++ b/ipalib/plugins/migration.py
@@ -140,7 +140,6 @@ _dn_err_msg = _('Malformed DN')
 
 _supported_schemas = (u'RFC2307bis', u'RFC2307')
 
-_compat_dn = DN(('cn', 'Schema Compatibility'), ('cn', 'plugins'), ('cn', 'config'))
 
 def _pre_migrate_user(ldap, pkey, dn, entry_attrs, failed, config, ctx, **kwargs):
     assert isinstance(dn, DN)
@@ -879,10 +878,8 @@ can use their Kerberos accounts.''')
         #check whether the compat plugin is enabled
         if not options.get('compat'):
             try:
-                check_compat = ldap.get_entry(_compat_dn)
-                if check_compat is not None and \
-                        check_compat.get('nsslapd-pluginenabled', [''])[0].lower() == 'on':
-                    return dict(result={}, failed={}, enabled=True, compat=False)
+                ldap.get_entry(DN(('cn', 'compat'), (api.env.basedn)))
+                return dict(result={}, failed={}, enabled=True, compat=False)
             except errors.NotFound:
                 pass
 
-- 
2.1.0