#50407 Issue 50390 - Add Managed Entries Plug-in Config Entry schema
Closed 3 years ago by spichugi. Opened 4 years ago by vashirov.
vashirov/389-ds-base mep-compat  into  master

file modified
+21 -5
@@ -1,5 +1,5 @@ 

  # --- BEGIN COPYRIGHT BLOCK ---

- # Copyright (C) 2015 Red Hat, Inc.

+ # Copyright (C) 2019 Red Hat, Inc.

  # All rights reserved.

  #

  # License: GPL (version 3 or any later version).
@@ -15,6 +15,7 @@ 

  from lib389._mapped_object import DSLdapObjects, DSLdapObject

  from lib389.lint import DSRILE0001

  from lib389.utils import ensure_str, ensure_list_bytes

+ from lib389.schema import Schema

  from lib389._constants import DN_PLUGIN

  from lib389.properties import (

          PLUGINS_OBJECTCLASS_VALUE, PLUGIN_PROPNAME_TO_ATTRNAME,
@@ -294,9 +295,17 @@ 

      def __init__(self, instance, dn):

          super(MEPConfig, self).__init__(instance, dn)

          self._rdn_attribute = 'cn'

-         self._must_attributes = ['cn', 'originScope', 'originFilter',

-                                  'managedBase', 'managedTemplate']

-         self._create_objectclasses = ['top', 'mepConfigEntry']

+         schema = Schema(instance)

+         for oc in schema.get_objectclasses():

+             if oc.oid == '2.16.840.1.113730.3.2.336':

+                 self._must_attributes = ['cn', 'originScope', 'originFilter',

+                                          'managedBase', 'managedTemplate']

+                 self._create_objectclasses = ['top', 'mepConfigEntry']

+                 break

+         else:

+             # Workaround for older versions without MEP schema

+             self._must_attributes = ['cn']

+             self._create_objectclasses = ['top', 'extensibleObject']

          self._protected = False

  

  
@@ -311,7 +320,14 @@ 

  

      def __init__(self, instance, basedn=None):

          super(MEPConfigs, self).__init__(instance)

-         self._objectclasses = ['top', 'mepConfigEntry']

+         schema = Schema(instance)

+         for oc in schema.get_objectclasses():

+             if oc.oid == '2.16.840.1.113730.3.2.336':

+                 self._objectclasses = ['top', 'mepConfigEntry']

+                 break

+         else:

+             # Workaround for older versions without MEP schema

+             self._objectclasses = ['top', 'extensibleObject']

          self._filterattrs = ['cn']

          self._childobject = MEPConfig

          # So we can set the configArea easily

Bug Description:
On older versions without the MEP config entry schema lib389 fails
to configure MEP plugin

Fix Description:
Check if we have required schema present, otherwise fallback to extensibleObject

Relates https://pagure.io/389-ds-base/issue/50390

Reviewed by: ???

rebased onto 71e2711

4 years ago

Pull-Request has been merged by vashirov

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3465

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata