| |
@@ -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: ???