Ejemplo n.º 1
0
def set_changelog_trimming(instance):
    log.info('Set nsslapd-changelogmaxage to 30d')

    if ds_supports_new_changelog():
        cl = Changelog(instance, DEFAULT_SUFFIX)
    else:
        cl = Changelog5(instance)
    cl.replace('nsslapd-changelogmaxage', '30')
Ejemplo n.º 2
0
def test_default_cl_trimming_enabled(topo_m2):
    """Check that changelog trimming was enabled by default

    :id: c37b9a28-f961-4867-b8a1-e81edd7f9bf3
    :setup: Supplier Instance
    :steps:
        1. Check changelog has trimming set up by default
    :expectedresults:
        1. Success
    """

    # Set up changelog trimming by default
    cl = Changelog(topo_m2.ms["supplier1"], DEFAULT_SUFFIX)
    assert cl.get_attr_val_utf8("nsslapd-changelogmaxage") == "7d"
Ejemplo n.º 3
0
def test_healthcheck_changelog_trimming_not_configured(topology_m2):
    """Check if HealthCheck returns DSCLLE0001 code

    :id: c2165032-88ba-4978-a4ca-2fecfd8c35d8
    :setup: Replicated topology
    :steps:
        1. Create a replicated topology
        2. On M1, check that value of nsslapd-changelogmaxage from cn=changelog5,cn=config is None
        3. Use HealthCheck without --json option
        4. Use HealthCheck with --json option
        5. On M1, set nsslapd-changelogmaxage to 30d
        6. Use HealthCheck without --json option
        7. Use HealthCheck with --json option
    :expectedresults:
        1. Success
        2. Success
        3. Healthcheck reports DSCLLE0001 code and related details
        4. Healthcheck reports DSCLLE0001 code and related details (json)
        5. Success
        6. Healthcheck reports no issue found
        7. Healthcheck reports no issue found (json)
    """

    M1 = topology_m2.ms['master1']

    RET_CODE = 'DSCLLE0001'

    log.info('Get the changelog entries for M1')
    changelog_m1 = Changelog(M1, suffix=DEFAULT_SUFFIX)

    log.info('Check nsslapd-changelogmaxage value')
    if changelog_m1.get_attr_val('nsslapd-changelogmaxage') is not None:
        changelog_m1.remove_all('nsslapd-changelogmaxage')

    time.sleep(3)

    run_healthcheck_and_flush_log(topology_m2, M1, RET_CODE, json=False)
    run_healthcheck_and_flush_log(topology_m2, M1, RET_CODE, json=True)

    set_changelog_trimming(M1)

    run_healthcheck_and_flush_log(topology_m2, M1, CMD_OUTPUT, json=False)
    run_healthcheck_and_flush_log(topology_m2, M1, JSON_OUTPUT, json=True)
Ejemplo n.º 4
0
 def _lint_cl_trimming(self):
     """Check that cl trimming is at least defined to prevent unbounded growth"""
     suffix = self.get_attr_val_utf8('nsslapd-suffix')
     replicas = Replicas(self._instance)
     replica = replicas.get(suffix)
     bename = self.lint_uid()
     if replica is not None:
         cl = Changelog(self._instance, suffix=suffix)
         try:
             if cl.get_attr_val_utf8('nsslapd-changelogmaxentries') is None and \
                cl.get_attr_val_utf8('nsslapd-changelogmaxage') is None:
                 report = copy.deepcopy(DSCLLE0001)
                 report['fix'] = report['fix'].replace(
                     'YOUR_INSTANCE', self._instance.serverid)
                 report['check'] = f'backends:{bename}::cl_trimming'
                 yield report
         except:
             # No changelog
             pass
Ejemplo n.º 5
0
 def _lint_cl_trimming(self):
     """Check that cl trimming is at least defined to prevent unbounded growth"""
     bename = self.lint_uid()
     suffix = self.get_attr_val_utf8('nsslapd-suffix')
     replicas = Replicas(self._instance)
     try:
         # Check if replication is enabled
         replicas.get(suffix)
         # Check the changelog
         cl = Changelog(self._instance, suffix=suffix)
         if cl.get_attr_val_utf8('nsslapd-changelogmaxentries') is None and \
            cl.get_attr_val_utf8('nsslapd-changelogmaxage') is None:
             report = copy.deepcopy(DSCLLE0001)
             report['fix'] = report['fix'].replace('YOUR_INSTANCE',
                                                   self._instance.serverid)
             report['check'] = f'backends:{bename}::cl_trimming'
             yield report
     except:
         # Suffix is not replicated
         self._log.debug(
             f"_lint_cl_trimming - backend ({suffix}) is not replicated")
         pass
Ejemplo n.º 6
0
def set_changelog_trimming(instance):
    log.info('Get the changelog enteries')
    inst_changelog = Changelog(instance, suffix=DEFAULT_SUFFIX)

    log.info('Set nsslapd-changelogmaxage to 30d')
    inst_changelog.add('nsslapd-changelogmaxage', '30')