Blame SOURCES/0011-Ticket-50413-ds-replcheck-Always-display-the-Result-.patch

232633
From e064b0b340936756e5d35180eb68d121ae828de4 Mon Sep 17 00:00:00 2001
232633
From: Mark Reynolds <mreynolds@redhat.com>
232633
Date: Thu, 30 May 2019 15:38:27 -0400
232633
Subject: [PATCH 07/12] Ticket 50413 - ds-replcheck - Always display the Result
232633
 Summary
232633
232633
Description:  Previously we only printed a "Result Summary" if there
232633
              were no inconsistencies and the entry counts matched.
232633
              However, the entry counts do not need to match.  So
232633
              this made the "Result Summary" checks too strict, and
232633
              if things were out of sync there was no Result Summary
232633
              printed at all.  This fix just always prints a result
232633
              summary and it removes the entry count check.
232633
232633
https://pagure.io/389-ds-base/issue/50413
232633
232633
Reviewed by: ?
232633
---
232633
 ldap/admin/src/scripts/ds-replcheck | 29 +++++++++++++++++------------
232633
 1 file changed, 17 insertions(+), 12 deletions(-)
232633
232633
diff --git a/ldap/admin/src/scripts/ds-replcheck b/ldap/admin/src/scripts/ds-replcheck
232633
index 5d7295e50..4abb417af 100755
232633
--- a/ldap/admin/src/scripts/ds-replcheck
232633
+++ b/ldap/admin/src/scripts/ds-replcheck
232633
@@ -661,14 +661,14 @@ def do_offline_report(opts, output_file=None):
232633
         MLDIF = open(opts['mldif'], "r")
232633
     except Exception as e:
232633
         print('Failed to open Master LDIF: ' + str(e))
232633
-        return None
232633
+        return
232633
 
232633
     try:
232633
         RLDIF = open(opts['rldif'], "r")
232633
     except Exception as e:
232633
         print('Failed to open Replica LDIF: ' + str(e))
232633
         MLDIF.close()
232633
-        return None
232633
+        return
232633
 
232633
     # Verify LDIF Files
232633
     try:
232633
@@ -679,7 +679,7 @@ def do_offline_report(opts, output_file=None):
232633
         print('Master LDIF file in invalid, aborting...')
232633
         MLDIF.close()
232633
         RLDIF.close()
232633
-        return None
232633
+        return
232633
     try:
232633
         if opts['verbose']:
232633
             print("Validating Replica ldif file ({})...".format(opts['rldif']))
232633
@@ -688,7 +688,7 @@ def do_offline_report(opts, output_file=None):
232633
         print('Replica LDIF file is invalid, aborting...')
232633
         MLDIF.close()
232633
         RLDIF.close()
232633
-        return None
232633
+        return
232633
 
232633
     # Get all the dn's, and entry counts
232633
     if opts['verbose']:
232633
@@ -845,10 +845,13 @@ def do_offline_report(opts, output_file=None):
232633
         final_report += ('=====================================================\n\n')
232633
     for diff in diff_report:
232633
         final_report += ('%s\n' % (diff))
232633
-    if missing_report == "" and len(diff_report) == 0 and m_count == r_count:
232633
-        final_report += ('\nResult\n')
232633
-        final_report += ('=====================================================\n\n')
232633
-        final_report += ('No differences between Master and Replica\n')
232633
+
232633
+    final_report += ('\nResult\n')
232633
+    final_report += ('=====================================================\n\n')
232633
+    if missing_report == "" and len(diff_report) == 0:
232633
+        final_report += ('No replication differences between Master and Replica\n')
232633
+    else:
232633
+        final_report += ('There are replication differences between Master and Replica\n')
232633
 
232633
     if output_file:
232633
         output_file.write(final_report)
232633
@@ -1130,10 +1133,12 @@ def print_online_report(report, opts, output_file):
232633
         for diff in report['diff']:
232633
             final_report += ('%s\n' % (diff))
232633
 
232633
-    if not missing and len(report['diff']) == 0 and report['m_count'] == report['r_count']:
232633
-        final_report += ('\nResult\n')
232633
-        final_report += ('=====================================================\n\n')
232633
-        final_report += ('No differences between Master and Replica\n')
232633
+    final_report += ('\nResult\n')
232633
+    final_report += ('=====================================================\n\n')
232633
+    if not missing and len(report['diff']) == 0:
232633
+        final_report += ('No replication differences between Master and Replica\n')
232633
+    else:
232633
+        final_report += ('There are replication differences between Master and Replica\n')
232633
 
232633
     if output_file:
232633
         output_file.write(final_report)
232633
-- 
232633
2.21.0
232633