86baa9
From 6c72f4241c70200d3d6637c254c07504aa19cdc9 Mon Sep 17 00:00:00 2001
86baa9
From: Florence Blanc-Renaud <flo@redhat.com>
86baa9
Date: Mon, 25 Mar 2019 14:22:59 +0100
86baa9
Subject: [PATCH] ipa-replica-manage: fix force-sync
86baa9
86baa9
ipa-replica-manage force-sync --from <server> is performing a wrong check
86baa9
that may result in the tool looping on "No status yet".
86baa9
86baa9
force-sync is adding a nsds5replicaupdateschedule attribute to the
86baa9
replication agreement in order to force replication to wake up. Note that
86baa9
this is not a re-initialization (re init drops the current db and reloads
86baa9
the entire db).
86baa9
86baa9
In a second step, force-sync is checking the replication agreement by reading
86baa9
nsds5BeginReplicaRefresh, nsds5ReplicaLastInitStatus,
86baa9
nsds5ReplicaLastInitStart and nsds5ReplicaLastInitEnd. This is a wrong
86baa9
test as force-sync is not an init operation and does not touch these
86baa9
attributes.
86baa9
86baa9
The tool should call wait_for_repl_update rather than wait_for_repl_init.
86baa9
This way, the check is done on the replication agreement attributes
86baa9
nsds5replicaUpdateInProgress, nsds5ReplicaLastUpdateStatus,
86baa9
nsds5ReplicaLastUpdateStart and nsds5ReplicaLastUpdateEnd.
86baa9
86baa9
Fixes: https://pagure.io/freeipa/issue/7886
86baa9
---
86baa9
 install/tools/ipa-replica-manage | 2 +-
86baa9
 1 file changed, 1 insertion(+), 1 deletion(-)
86baa9
86baa9
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
86baa9
index cffed58b79f3e2cc41f8cf45b066f3843da01915..2a875b8fa58390c704d36b7d355ac79181021c35 100755
86baa9
--- a/install/tools/ipa-replica-manage
86baa9
+++ b/install/tools/ipa-replica-manage
86baa9
@@ -1246,7 +1246,7 @@ def force_sync(realm, thishost, fromhost, dirman_passwd, nolookup=False):
86baa9
         repl = replication.ReplicationManager(realm, fromhost, dirman_passwd)
86baa9
         repl.force_sync(repl.conn, thishost)
86baa9
         agreement = repl.get_replication_agreement(thishost)
86baa9
-        repl.wait_for_repl_init(repl.conn, agreement.dn)
86baa9
+        repl.wait_for_repl_update(repl.conn, agreement.dn)
86baa9
         ds.replica_manage_time_skew(prevent=True)
86baa9
 
86baa9
 def show_DNA_ranges(hostname, master, realm, dirman_passwd, nextrange=False,
86baa9
-- 
86baa9
2.20.1
86baa9