#50763 Issue 50753 - Dumping the changelog to a file doesn't work
Closed 3 years ago by spichugi. Opened 4 years ago by spichugi.
spichugi/389-ds-base dump-changelog-file  into  master

@@ -1000,7 +1000,8 @@ 

      if not args.changelog_ldif:

          replicas.process_and_dump_changelog(replica_roots=args.replica_roots,

                                              csn_only=args.csn_only,

-                                             preserve_ldif_done=args.preserve_ldif_done)

+                                             preserve_ldif_done=args.preserve_ldif_done,

+                                             log=log)

      else:

          try:

              assert os.path.exists(args.changelog_ldif)

file modified
+7 -4
@@ -1648,7 +1648,7 @@ 

              replica._populate_suffix()

          return replica

  

-     def process_and_dump_changelog(self, replica_roots=[], csn_only=False, preserve_ldif_done=False):

+     def process_and_dump_changelog(self, replica_roots=[], csn_only=False, preserve_ldif_done=False, log=None):

          """Dump and decode Directory Server replication change log

  

          :param replica_roots: Replica suffixes that need to be processed
@@ -1657,6 +1657,9 @@ 

          :type csn_only: bool

          """

  

+         if log is None:

+             log = self._log

+ 

          repl_roots = []

          try:

              cl = Changelog5(self._instance)
@@ -1677,7 +1680,7 @@ 

              got_ldif = False

              current_time = time.time()

              replica = self.get(repl_root)

-             self._log.info(f"# Replica Root: {repl_root}")

+             log.info(f"# Replica Root: {repl_root}")

              replica.replace("nsDS5Task", 'CL2LDIF')

  

              # Decode the dumped changelog
@@ -1687,7 +1690,7 @@ 

                  if os.path.getmtime(file_path) < current_time:

                      continue

                  got_ldif = True

-                 cl_ldif = ChangelogLDIF(file_path, self._log)

+                 cl_ldif = ChangelogLDIF(file_path, log)

  

                  if csn_only:

                      cl_ldif.grep_csn()
@@ -1700,7 +1703,7 @@ 

                      os.remove(file_path)

  

              if not got_ldif:

-                 self._log.info("LDIF file: Not found")

+                 log.info("LDIF file: Not found")

  

  

  class BootstrapReplicationManager(DSLdapObject):

Description: Pass the logging object to the code branch where
-i CHANGELOG_FILE is not specified, so -o OUTPUT_FILE works
correctly in that case too.

https://pagure.io/389-ds-base/issue/50753

Reviewed by: ?

rebased onto ce8b4ca

4 years ago

Pull-Request has been merged by spichugi

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3818

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago