Skip to content

Commit

Permalink
bare exception, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jchapma committed Dec 9, 2024
1 parent 3168940 commit 6ad5f98
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
3 changes: 3 additions & 0 deletions dirsrvtests/tests/suites/healthcheck/health_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def test_healthcheck_RI_plugin_missing_indexes(topology_st):
MEMBER_DN = 'cn=member,cn=index,cn=userroot,cn=ldbm database,cn=plugins,cn=config'

standalone = topology_st.standalone
standalone.config.set("nsslapd-accesslog-logbuffering", "on")

log.info('Enable RI plugin')
plugin = ReferentialIntegrityPlugin(standalone)
Expand Down Expand Up @@ -214,6 +215,7 @@ def test_healthcheck_MO_plugin_missing_indexes(topology_st):
MO_GROUP_ATTR = 'creatorsname'

standalone = topology_st.standalone
standalone.config.set("nsslapd-accesslog-logbuffering", "on")

log.info('Enable MO plugin')
plugin = MemberOfPlugin(standalone)
Expand Down Expand Up @@ -280,6 +282,7 @@ def test_healthcheck_MO_plugin_substring_index(topology_st):
UNIQUE_MEMBER_DN = 'cn=uniquemember,cn=index,cn=userroot,cn=ldbm database,cn=plugins,cn=config'

standalone = topology_st.standalone
standalone.config.set("nsslapd-accesslog-logbuffering", "on")

log.info('Enable MO plugin')
plugin = MemberOfPlugin(standalone)
Expand Down
2 changes: 1 addition & 1 deletion src/lib389/lib389/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
from the large group can be slow.
""",
'fix': """If not required you can remove the substring index type using dsconf:
'fix': """If not required, you can remove the substring index type using dsconf:
# dsconf slapd-YOUR_INSTANCE backend index set --attr=ATTR BACKEND --del-type=sub
"""
Expand Down
11 changes: 3 additions & 8 deletions src/lib389/lib389/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def _lint_member_substring_index(self):
if self.status():
from lib389.backend import Backends
backends = Backends(self._instance).list()
attrs = self.get_attr_vals_utf8_l("memberofgroupattr")
membership_attrs = ['member', 'uniquemember']
container = self.get_attr_val_utf8_l("nsslapd-plugincontainerscope")
for backend in backends:
suffix = backend.get_attr_val_utf8_l('nsslapd-suffix')
Expand All @@ -844,17 +844,12 @@ def _lint_member_substring_index(self):
# skip this backend that is not in the scope
continue
indexes = backend.get_indexes()
membership_attrs = ['member', 'uniquemember']
for attr in membership_attrs:
report = copy.deepcopy(DSMOLE0002)
try:
index = indexes.get(attr)
types = index.get_attr_vals_utf8_l("nsIndexType")
valid = True
if "sub" in types:
valid = False

if not valid:
report['detail'] = report['detail'].replace('ATTR', attr)
report['detail'] = report['detail'].replace('BACKEND', suffix)
report['fix'] = report['fix'].replace('ATTR', attr)
Expand All @@ -864,8 +859,8 @@ def _lint_member_substring_index(self):
report['items'].append(attr)
report['check'] = f'attr:substring_index'
yield report
except:
pass
except KeyError:
continue

def get_attr(self):
"""Get memberofattr attribute"""
Expand Down

0 comments on commit 6ad5f98

Please sign in to comment.