mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 08:21:05 -06:00
c08c7e1156
A long time ago the DS team recommended that the changelog trimming interval be set to 7 days. However, more recently we tend to see more time skews on certain platforms, and issues where it appears changes were trimmed too early (which can break replication). It would be better to set the trimming interval to 30 days. This still prevents the changelog from getting too large, and it should help with some of the other issues we are now seeing. Fixes: https://pagure.io/freeipa/issue/8464 Signed-off-by: Mark Reynolds <mreynolds@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
#
|
|
# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
|
|
#
|
|
import logging
|
|
from ipalib import Registry, errors
|
|
from ipalib import Updater
|
|
from ipapython.dn import DN
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
register = Registry()
|
|
|
|
|
|
@register()
|
|
class update_changelog_maxage(Updater):
|
|
"""
|
|
Update the changelog maxage if it is not set
|
|
"""
|
|
|
|
def update_entry(self, cl_entry, conn):
|
|
maxage = cl_entry.single_value.get('nsslapd-changelogmaxage')
|
|
if maxage is None:
|
|
cl_entry['nsslapd-changelogmaxage'] = '30d'
|
|
conn.update_entry(cl_entry)
|
|
|
|
def execute(self, **options):
|
|
ldap = self.api.Backend.ldap2
|
|
|
|
for backend in ('userroot', 'ipaca'):
|
|
dn = DN(
|
|
('cn', 'changelog'),
|
|
('cn', backend),
|
|
('cn', 'ldbm database'),
|
|
('cn', 'plugins'),
|
|
('cn', 'config'))
|
|
try:
|
|
cl_entry = ldap.get_entry(dn, ['nsslapd-changelogmaxage'])
|
|
self.update_entry(cl_entry, ldap)
|
|
except errors.NotFound:
|
|
# Try the old global changelog, and return
|
|
dn = DN(
|
|
('cn', 'changelog5'),
|
|
('cn', 'config'))
|
|
try:
|
|
cl_entry = ldap.get_entry(dn, ['nsslapd-changelogmaxage'])
|
|
self.update_entry(cl_entry, ldap)
|
|
except errors.NotFound:
|
|
logger.debug('Error retrieving: %s', str(dn))
|
|
return False, []
|
|
|
|
return False, []
|