andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

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

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