Commit 9d3860fe authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import 389-ds-base-1.4.2.4-8.module+el8.2.0+5959+cfcaedbd

parent 6753a945
50c525db2c9adfc7cca119ed13110a42d88d079c SOURCES/389-ds-base-1.4.1.3.tar.bz2
5a5255f7bca3e79a063f26f292cf93f17fe3b14f SOURCES/jemalloc-5.2.0.tar.bz2
fcf4e095176c048550be8838df112b8d247f34db SOURCES/389-ds-base-1.4.2.4.tar.bz2
9e06b5cc57fd185379d007696da153893cf73e30 SOURCES/jemalloc-5.2.1.tar.bz2
SOURCES/389-ds-base-1.4.1.3.tar.bz2
SOURCES/jemalloc-5.2.0.tar.bz2
SOURCES/389-ds-base-1.4.2.4.tar.bz2
SOURCES/jemalloc-5.2.1.tar.bz2
From b823da0b0e3f02a7972ebec4e714877d2ee2170e Mon Sep 17 00:00:00 2001
From: Viktor Ashirov <vashirov@redhat.com>
Date: Fri, 15 Nov 2019 11:55:07 +0100
Subject: [PATCH 1/2] Issue 50712 - Version comparison doesn't work correctly
on git builds
Bug Description:
`python3-packaging` is not shipped in RHEL8. But it's bundled with
`setuptools` which is present in all major distributions.
Fix Description:
Use `pkg_resources` module from `setuptools` which provides needed
functionality, change lib389 and rpm dependencies accordingly.
Unfortunately, `pkg_resources.parse_version()` returns different
objects for different strings too, so use `LegacyVersion` directly
from `pkg_resources.extern.packaging.version`.
Fixes: https://pagure.io/389-ds-base/issue/50712
Relates: https://pagure.io/389-ds-base/issue/50706
---
rpm/389-ds-base.spec.in | 2 +-
src/lib389/lib389/tests/utils_test.py | 29 +++++++++++++++++++++++++++
src/lib389/lib389/utils.py | 11 +++++-----
src/lib389/requirements.txt | 2 +-
src/lib389/setup.py | 2 +-
5 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index e60b0f3c5..6f4a1e1a9 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -130,7 +130,6 @@ BuildRequires: python%{python3_pkgversion}-argcomplete
BuildRequires: python%{python3_pkgversion}-argparse-manpage
BuildRequires: python%{python3_pkgversion}-policycoreutils
BuildRequires: python%{python3_pkgversion}-libselinux
-BuildRequires: python%{python3_pkgversion}-packaging
# For cockpit
BuildRequires: rsync
@@ -303,6 +302,7 @@ Requires: python%{python3_pkgversion}-pyasn1-modules
Requires: python%{python3_pkgversion}-dateutil
Requires: python%{python3_pkgversion}-argcomplete
Requires: python%{python3_pkgversion}-libselinux
+Requires: python%{python3_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_pkgversion}-lib389}
%description -n python%{python3_pkgversion}-lib389
diff --git a/src/lib389/lib389/tests/utils_test.py b/src/lib389/lib389/tests/utils_test.py
index 5378066b6..a696eb5c9 100644
--- a/src/lib389/lib389/tests/utils_test.py
+++ b/src/lib389/lib389/tests/utils_test.py
@@ -145,6 +145,35 @@ def test_get_log_data(data):
assert display_log_data(before) == after
+@pytest.mark.parametrize('ds_ver, cmp_ver', [
+ ('1.3.1', '1.3.2'),
+ ('1.3.1', '1.3.10'),
+ ('1.3.2', '1.3.10'),
+ ('1.3.9', ('1.3.10', '1.4.2.0')),
+ ('1.4.0.1', ('1.3.9', '1.4.1.0', '1.4.2.1')),
+ ('1.4.1', '1.4.2.0-20191115gitbadc0ffee' ),
+])
+def test_ds_is_older_versions(ds_ver, cmp_ver):
+ if isinstance(cmp_ver, tuple):
+ assert ds_is_related('older', ds_ver, *cmp_ver)
+ else:
+ assert ds_is_related('older', ds_ver, cmp_ver)
+
+@pytest.mark.parametrize('ds_ver, cmp_ver', [
+ ('1.3.2', '1.3.1'),
+ ('1.3.10', '1.3.1'),
+ ('1.3.10', '1.3.2'),
+ ('1.3.10', ('1.3.9', '1.4.2.0')),
+ ('1.4.2.1', ('1.3.9', '1.4.0.1', '1.4.2.0')),
+ ('1.4.2.0-20191115gitbadc0ffee', '1.4.1' ),
+])
+def test_ds_is_newer_versions(ds_ver, cmp_ver):
+ if isinstance(cmp_ver, tuple):
+ assert ds_is_related('newer', ds_ver, *cmp_ver)
+ else:
+ assert ds_is_related('newer', ds_ver, cmp_ver)
+
+
if __name__ == "__main__":
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s -v %s" % CURRENT_FILE)
diff --git a/src/lib389/lib389/utils.py b/src/lib389/lib389/utils.py
index 3234cdccb..b9eacfdea 100644
--- a/src/lib389/lib389/utils.py
+++ b/src/lib389/lib389/utils.py
@@ -40,7 +40,7 @@ import shlex
import operator
import subprocess
import math
-from packaging.version import LegacyVersion
+from pkg_resources.extern.packaging.version import LegacyVersion
from socket import getfqdn
from ldapurl import LDAPUrl
from contextlib import closing
@@ -1067,13 +1067,12 @@ def get_ds_version():
return p.version
-def ds_is_related(relation, *ver):
+def ds_is_related(relation, ds_ver, *ver):
"""
Return a result of a comparison between the current version of ns-slapd and a provided version.
"""
ops = {'older': operator.lt,
'newer': operator.ge}
- ds_ver = get_ds_version()
if len(ver) > 1:
for cmp_ver in ver:
if cmp_ver.startswith(ds_ver[:3]):
@@ -1086,14 +1085,16 @@ def ds_is_older(*ver):
"""
Return True if the current version of ns-slapd is older than a provided version
"""
- return ds_is_related('older', *ver)
+ ds_ver = get_ds_version()
+ return ds_is_related('older', ds_ver, *ver)
def ds_is_newer(*ver):
"""
Return True if the current version of ns-slapd is newer than a provided version
"""
- return ds_is_related('newer', *ver)
+ ds_ver = get_ds_version()
+ return ds_is_related('newer', ds_ver, *ver)
def gentime_to_datetime(gentime):
diff --git a/src/lib389/requirements.txt b/src/lib389/requirements.txt
index 5cce1d04b..eb2475f3b 100644
--- a/src/lib389/requirements.txt
+++ b/src/lib389/requirements.txt
@@ -6,4 +6,4 @@ six
argcomplete
argparse-manpage
python-ldap
-packaging
+setuptools
diff --git a/src/lib389/setup.py b/src/lib389/setup.py
index f2e404333..056173936 100644
--- a/src/lib389/setup.py
+++ b/src/lib389/setup.py
@@ -82,7 +82,7 @@ setup(
'argcomplete',
'argparse-manpage',
'python-ldap',
- 'packaging',
+ 'setuptools',
],
cmdclass={
--
2.21.0
From 00bc5150aeb5e0d7676d0c578cd64a3977ae5d85 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 15 Nov 2019 11:04:14 -0500
Subject: [PATCH 2/2] Issue 50499 - Fix npm audit issues
Description: Updated npm handlebars package to 4.5.2
relates: https://pagure.io/389-ds-base/issue/50499
---
src/cockpit/389-console/package-lock.json | 12 ++++++------
src/cockpit/389-console/package.json | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/cockpit/389-console/package-lock.json b/src/cockpit/389-console/package-lock.json
index 7207e92a0..f61e48985 100644
--- a/src/cockpit/389-console/package-lock.json
+++ b/src/cockpit/389-console/package-lock.json
@@ -6053,9 +6053,9 @@
"integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw=="
},
"handlebars": {
- "version": "4.5.1",
- "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
- "integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
+ "version": "4.5.2",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.2.tgz",
+ "integrity": "sha512-29Zxv/cynYB7mkT1rVWQnV7mGX6v7H/miQ6dbEpYTKq5eJBN7PsRB+ViYJlcT6JINTSu4dVB9kOqEun78h6Exg==",
"requires": {
"neo-async": "^2.6.0",
"optimist": "^0.6.1",
@@ -6075,9 +6075,9 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
},
"uglify-js": {
- "version": "3.6.7",
- "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.7.tgz",
- "integrity": "sha512-4sXQDzmdnoXiO+xvmTzQsfIiwrjUCSA95rSP4SEd8tDb51W2TiDOlL76Hl+Kw0Ie42PSItCW8/t6pBNCF2R48A==",
+ "version": "3.6.9",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.9.tgz",
+ "integrity": "sha512-pcnnhaoG6RtrvHJ1dFncAe8Od6Nuy30oaJ82ts6//sGSXOP5UjBMEthiProjXmMNHOfd93sqlkztifFMcb+4yw==",
"optional": true,
"requires": {
"commander": "~2.20.3",
diff --git a/src/cockpit/389-console/package.json b/src/cockpit/389-console/package.json
index ffa429d83..fb2449675 100644
--- a/src/cockpit/389-console/package.json
+++ b/src/cockpit/389-console/package.json
@@ -52,7 +52,7 @@
"@patternfly/react-core": "^3.58.1",
"bootstrap": "^4.3.1",
"file-loader": "^4.1.0",
- "handlebars": "^4.4.5",
+ "handlebars": "^4.5.2",
"node-sass": "4.12.0",
"patternfly": "^3.59.3",
"patternfly-react": "^2.34.3",
--
2.21.0
From 09326585a5561480d44beb508af2cb1da52bfff6 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Mon, 18 Nov 2019 12:02:39 -0500
Subject: [PATCH] Issue 50701 - Add additional healthchecks to dsconf
Description: New checks and several design changes have been implemented
Design changes:
- Moved to a "yield" design, where a lint function can return multiple results
- Revised the lint report so it's easier to read and distiguish between multiple
errors
- Revised most lint errors to include CLI examples on how to fix the issue
New Checks:
- Check TLS certs for expired/expiring
- Add RI plugin checks for missing indexes for RI member attributes
- Added Disk Space check
- Add Virtual Attribute index check
- Add replication agmt status check
- Add replication conflict entry check
- File System checks (/etc/revolv.conf, and NSS pin files)
- Replication changelog trimming
relates: https://pagure.io/389-ds-base/issue/50701
Reviewed by: firstyear, mhonek, tbordaz, and spichugi (Thanks!!!!)
add suggested changes
Improved the replication agreement health checks to use the new
state levels (red, amber, green), and we use that to generate
different reports.
Also improved report example autofilling of the values, so the exact
commands can be copied and pasted.
Added a changelog trimming check as well.
Updated the help section to wanr that htehealthcheck feature should
only be run on the local instance
Moved healthcheck to dsctl and added file permission checks
---
src/lib389/cli/dsconf | 2 -
src/lib389/cli/dsctl | 10 +-
src/lib389/lib389/_mapped_object.py | 6 +-
src/lib389/lib389/agreement.py | 67 +++++--
src/lib389/lib389/backend.py | 122 +++++++++---
src/lib389/lib389/cli_base/dsrc.py | 6 +-
src/lib389/lib389/cli_conf/health.py | 62 ------
src/lib389/lib389/cli_ctl/health.py | 123 ++++++++++++
src/lib389/lib389/config.py | 18 +-
src/lib389/lib389/dseldif.py | 43 +++-
src/lib389/lib389/lint.py | 287 +++++++++++++++++++++++----
src/lib389/lib389/monitor.py | 14 ++
src/lib389/lib389/nss_ssl.py | 35 +++-
src/lib389/lib389/plugins.py | 46 ++++-
src/lib389/lib389/properties.py | 1 +
src/lib389/lib389/replica.py | 70 +++++++
16 files changed, 746 insertions(+), 166 deletions(-)
delete mode 100644 src/lib389/lib389/cli_conf/health.py
create mode 100644 src/lib389/lib389/cli_ctl/health.py
diff --git a/src/lib389/cli/dsconf b/src/lib389/cli/dsconf
index 6e3ef19c3..5143756c8 100755
--- a/src/lib389/cli/dsconf
+++ b/src/lib389/cli/dsconf
@@ -21,7 +21,6 @@ from lib389.cli_conf import backend as cli_backend
from lib389.cli_conf import directory_manager as cli_directory_manager
from lib389.cli_conf import plugin as cli_plugin
from lib389.cli_conf import schema as cli_schema
-from lib389.cli_conf import health as cli_health
from lib389.cli_conf import monitor as cli_monitor
from lib389.cli_conf import saslmappings as cli_sasl
from lib389.cli_conf import pwpolicy as cli_pwpolicy
@@ -80,7 +79,6 @@ cli_backup.create_parser(subparsers)
cli_chaining.create_parser(subparsers)
cli_config.create_parser(subparsers)
cli_directory_manager.create_parsers(subparsers)
-cli_health.create_parser(subparsers)
cli_monitor.create_parser(subparsers)
cli_plugin.create_parser(subparsers)
cli_pwpolicy.create_parser(subparsers)
diff --git a/src/lib389/cli/dsctl b/src/lib389/cli/dsctl
index 31e906b7d..8b86629ac 100755
--- a/src/lib389/cli/dsctl
+++ b/src/lib389/cli/dsctl
@@ -16,14 +16,17 @@ import sys
import signal
import os
from lib389.utils import get_instance_list
-from lib389.cli_base import _get_arg, setup_script_logger, disconnect_instance
from lib389 import DirSrv
from lib389.cli_ctl import instance as cli_instance
from lib389.cli_ctl import dbtasks as cli_dbtasks
-from lib389.cli_base import disconnect_instance, setup_script_logger
-from lib389.cli_base import format_error_to_dict
from lib389.cli_ctl import tls as cli_tls
+from lib389.cli_ctl import health as cli_health
from lib389.cli_ctl.instance import instance_remove_all
+from lib389.cli_base import (
+ _get_arg,
+ disconnect_instance,
+ setup_script_logger,
+ format_error_to_dict)
from lib389._constants import DSRC_CONTAINER
parser = argparse.ArgumentParser()
@@ -54,6 +57,7 @@ if not os.path.exists(DSRC_CONTAINER):
cli_instance.create_parser(subparsers)
cli_dbtasks.create_parser(subparsers)
cli_tls.create_parser(subparsers)
+cli_health.create_parser(subparsers)
argcomplete.autocomplete(parser)
diff --git a/src/lib389/lib389/_mapped_object.py b/src/lib389/lib389/_mapped_object.py
index e331b3b27..4da112d25 100644
--- a/src/lib389/lib389/_mapped_object.py
+++ b/src/lib389/lib389/_mapped_object.py
@@ -978,9 +978,9 @@ class DSLdapObject(DSLogging):
return None
results = []
for fn in self._lint_functions:
- result = fn()
- if result:
- results.append(result)
+ for result in fn():
+ if result is not None:
+ results.append(result)
return results
diff --git a/src/lib389/lib389/agreement.py b/src/lib389/lib389/agreement.py
index a0d4597ec..93fd72895 100644
--- a/src/lib389/lib389/agreement.py
+++ b/src/lib389/lib389/agreement.py
@@ -105,6 +105,9 @@ class Agreement(DSLdapObject):
time.sleep(2)
return (done, error)
+ def get_name(self):
+ return self.get_attr_val_utf8_l('cn')
+
def get_agmt_maxcsn(self):
"""Get the agreement maxcsn from the database RUV entry
:returns: CSN string if found, otherwise None is returned
@@ -202,7 +205,7 @@ class Agreement(DSLdapObject):
consumer.close()
return result_msg
- def get_agmt_status(self, binddn=None, bindpw=None):
+ def get_agmt_status(self, binddn=None, bindpw=None, return_json=False):
"""Return the status message
:param binddn: Specifies a specific bind DN to use when contacting the remote consumer
:type binddn: str
@@ -211,33 +214,55 @@ class Agreement(DSLdapObject):
:returns: A status message about the replication agreement
"""
status = "Unknown"
-
+ con_maxcsn = "Unknown"
try:
agmt_maxcsn = self.get_agmt_maxcsn()
+ agmt_status = json.loads(self.get_attr_val_utf8_l(AGMT_UPDATE_STATUS_JSON))
if agmt_maxcsn is not None:
- con_maxcsn = self.get_consumer_maxcsn(binddn=binddn, bindpw=bindpw)
- if con_maxcsn:
- if agmt_maxcsn == con_maxcsn:
- status = "In Synchronization"
- else:
- # Not in sync - attempt to discover the cause
- repl_msg = "Unknown"
- if self.get_attr_val_utf8_l(AGMT_UPDATE_IN_PROGRESS) == 'true':
- # Replication is on going - this is normal
- repl_msg = "Replication still in progress"
- elif "can't contact ldap" in \
- self.get_attr_val_utf8_l(AGMT_UPDATE_STATUS):
- # Consumer is down
- repl_msg = "Consumer can not be contacted"
-
- status = ("Not in Synchronization: supplier " +
- "(%s) consumer (%s) Reason(%s)" %
- (agmt_maxcsn, con_maxcsn, repl_msg))
+ try:
+ con_maxcsn = self.get_consumer_maxcsn(binddn=binddn, bindpw=bindpw)
+ if con_maxcsn:
+ if agmt_maxcsn == con_maxcsn:
+ if return_json:
+ return json.dumps({
+ 'msg': "In Synchronization",
+ 'agmt_maxcsn': agmt_maxcsn,
+ 'con_maxcsn': con_maxcsn,
+ 'state': agmt_status['state'],
+ 'reason': agmt_status['message']
+ })
+ else:
+ return "In Synchronization"
+ except:
+ pass
+ else:
+ agmt_maxcsn = "Unknown"
+
+ # Not in sync - attempt to discover the cause
+ repl_msg = agmt_status['message']
+ if self.get_attr_val_utf8_l(AGMT_UPDATE_IN_PROGRESS) == 'true':
+ # Replication is on going - this is normal
+ repl_msg = "Replication still in progress"
+ elif "can't contact ldap" in agmt_status['message']:
+ # Consumer is down
+ repl_msg = "Consumer can not be contacted"
+
+ if return_json:
+ return json.dumps({
+ 'msg': "Not in Synchronization",
+ 'agmt_maxcsn': agmt_maxcsn,
+ 'con_maxcsn': con_maxcsn,
+ 'state': agmt_status['state'],
+ 'reason': repl_msg
+ })
+ else:
+ return ("Not in Synchronization: supplier " +
+ "(%s) consumer (%s) State (%s) Reason (%s)" %
+ (agmt_maxcsn, con_maxcsn, agmt_status['state'], repl_msg))
except ldap.INVALID_CREDENTIALS as e:
raise(e)
except ldap.LDAPError as e:
raise ValueError(str(e))
- return status
def get_lag_time(self, suffix, agmt_name, binddn=None, bindpw=None):
"""Get the lag time between the supplier and the consumer
diff --git a/src/lib389/lib389/backend.py b/src/lib389/lib389/backend.py
index 62fd0ae94..ac2af021c 100644
--- a/src/lib389/lib389/backend.py
+++ b/src/lib389/lib389/backend.py
@@ -7,6 +7,7 @@
# --- END COPYRIGHT BLOCK ---
from datetime import datetime
+import copy
import ldap
from lib389._constants import *
from lib389.properties import *
@@ -19,6 +20,8 @@ from lib389._mapped_object import DSLdapObjects, DSLdapObject
from lib389.mappingTree import MappingTrees
from lib389.exceptions import NoSuchEntryError, InvalidArgumentError
from lib389.replica import Replicas
+from lib389.cos import (CosTemplates, CosIndirectDefinitions,
+ CosPointerDefinitions, CosClassicDefinitions)
# We need to be a factor to the backend monitor
from lib389.monitor import MonitorBackend
@@ -30,7 +33,7 @@ from lib389.encrypted_attributes import EncryptedAttr, EncryptedAttrs
# This is for sample entry creation.
from lib389.configurations import get_sample_entries
-from lib389.lint import DSBLE0001
+from lib389.lint import DSBLE0001, DSBLE0002, DSBLE0003, DSVIRTLE0001
class BackendLegacy(object):
@@ -410,10 +413,92 @@ class Backend(DSLdapObject):
self._must_attributes = ['nsslapd-suffix', 'cn']
self._create_objectclasses = ['top', 'extensibleObject', BACKEND_OBJECTCLASS_VALUE]
self._protected = False
- self._lint_functions = [self._lint_mappingtree]
+ self._lint_functions = [self._lint_mappingtree, self._lint_search, self._lint_virt_attrs]
# Check if a mapping tree for this suffix exists.
self._mts = MappingTrees(self._instance)
+ def _lint_virt_attrs(self):
+ """Check if any virtual attribute are incorrectly indexed"""
+ indexes = self.get_indexes()
+ suffix = self.get_attr_val_utf8('nsslapd-suffix')
+
+ # First check nsrole
+ try:
+ indexes.get('nsrole')
+ report = copy.deepcopy(DSVIRTLE0001)
+ report['detail'] = report['detail'].replace('ATTR', 'nsrole')
+ report['fix'] = report['fix'].replace('ATTR', 'nsrole')
+ report['fix'] = report['fix'].replace('SUFFIX', suffix)
+ report['fix'] = report['fix'].replace('YOUR_INSTANCE', self._instance.serverid)
+ report['items'].append(suffix)
+ report['items'].append('nsrole')
+ yield report
+ except:
+ pass
+
+ # Check COS next
+ for cosDefType in [CosIndirectDefinitions, CosPointerDefinitions, CosClassicDefinitions]:
+ defs = cosDefType(self._instance, self._dn).list()
+ for cosDef in defs:
+ attrs = cosDef.get_attr_val_utf8_l("cosAttribute").split()
+ for attr in attrs:
+ if attr in ["default", "override", "operational", "operational-default", "merge-schemes"]:
+ # We are at the end, just break out
+ break
+ try:
+ indexes.get(attr)
+ # If we got here there is an index (bad)
+ report = copy.deepcopy(DSVIRTLE0001)
+ report['detail'] = report['detail'].replace('ATTR', attr)
+ report['fix'] = report['fix'].replace('ATTR', attr)
+ report['fix'] = report['fix'].replace('SUFFIX', suffix)
+ report['fix'] = report['fix'].replace('YOUR_INSTANCE', self._instance.serverid)
+ report['items'].append(suffix)
+ report['items'].append("Class Of Service (COS)")
+ report['items'].append("cosAttribute: " + attr)
+ yield report
+ except:
+ # this is what we hope for
+ pass
+
+ def _lint_search(self):
+ """Perform a search and make sure an entry is accessible
+ """
+ dn = self.get_attr_val_utf8('nsslapd-suffix')
+ suffix = DSLdapObject(self._instance, dn=dn)
+ try:
+ suffix.get_attr_val('objectclass')
+ except ldap.NO_SUCH_OBJECT:
+ # backend root entry not created yet
+ DSBLE0003['items'] = [dn, ]
+ yield DSBLE0003
+ except ldap.LDAPError as e:
+ # Some other error
+ DSBLE0002['detail'] = DSBLE0002['detail'].replace('ERROR', str(e))
+ DSBLE0002['items'] = [dn, ]
+ yield DSBLE0002
+
+ def _lint_mappingtree(self):
+ """Backend lint
+
+ This should check for:
+ * missing mapping tree entries for the backend
+ * missing indices if we are local and have log access?
+ """
+
+ # Check for the missing mapping tree.
+ suffix = self.get_attr_val_utf8('nsslapd-suffix')
+ bename = self.get_attr_val_bytes('cn')
+ try:
+ mt = self._mts.get(suffix)
+ if mt.get_attr_val_bytes('nsslapd-backend') != bename and mt.get_attr_val('nsslapd-state') != ensure_bytes('backend'):
+ raise ldap.NO_SUCH_OBJECT("We have a matching suffix, but not a backend or correct database name.")
+ except ldap.NO_SUCH_OBJECT:
+ result = DSBLE0001
+ result['items'] = [bename, ]
+ yield result
+ return None
+
def create_sample_entries(self, version):
"""Creates sample entries under nsslapd-suffix value
@@ -552,27 +637,6 @@ class Backend(DSLdapObject):
# Now remove our children, this is all ldbm config
self._instance.delete_branch_s(self._dn, ldap.SCOPE_SUBTREE)
- def _lint_mappingtree(self):
- """Backend lint
-
- This should check for:
- * missing mapping tree entries for the backend
- * missing indices if we are local and have log access?
- """
-
- # Check for the missing mapping tree.
- suffix = self.get_attr_val_utf8('nsslapd-suffix')
- bename = self.get_attr_val_bytes('cn')
- try: