3f51ca
From 469f8ba59eb369267a9d404291ce7794f996d9f4 Mon Sep 17 00:00:00 2001
3f51ca
From: Alexander Bokovoy <abokovoy@redhat.com>
3f51ca
Date: Mon, 16 Oct 2017 13:46:38 +0300
3f51ca
Subject: [PATCH] ipa-replica-manage: implicitly ignore initial time skew in
3f51ca
 force-sync
3f51ca
3f51ca
When performing force synchronization, implicitly ignore initial
3f51ca
time skew (if any) and restore it afterwards.
3f51ca
3f51ca
This also changes semantics of force-sync by waiting until the end of
3f51ca
the initial replication.
3f51ca
3f51ca
Fixes https://pagure.io/freeipa/issue/7211
3f51ca
3f51ca
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
3f51ca
---
3f51ca
 install/tools/ipa-replica-manage | 6 ++++++
3f51ca
 1 file changed, 6 insertions(+)
3f51ca
3f51ca
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
3f51ca
index f802201b7f93facb1e78463aa02eab66a1ae23ea..c00d8ca3a0fa8228c5aa782a270991f14ee16974 100755
3f51ca
--- a/install/tools/ipa-replica-manage
3f51ca
+++ b/install/tools/ipa-replica-manage
3f51ca
@@ -1231,8 +1231,14 @@ def force_sync(realm, thishost, fromhost, dirman_passwd, nolookup=False):
3f51ca
         repl = replication.ReplicationManager(realm, thishost, dirman_passwd)
3f51ca
         repl.force_sync(repl.conn, fromhost)
3f51ca
     else:
3f51ca
+        ds = dsinstance.DsInstance(realm_name=realm)
3f51ca
+        ds.ldapi = os.getegid() == 0
3f51ca
+        ds.replica_manage_time_skew(prevent=False)
3f51ca
         repl = replication.ReplicationManager(realm, fromhost, dirman_passwd)
3f51ca
         repl.force_sync(repl.conn, thishost)
3f51ca
+        agreement = repl.get_replication_agreement(thishost)
3f51ca
+        repl.wait_for_repl_init(repl.conn, agreement.dn)
3f51ca
+        ds.replica_manage_time_skew(prevent=True)
3f51ca
 
3f51ca
 def show_DNA_ranges(hostname, master, realm, dirman_passwd, nextrange=False,
3f51ca
                     nolookup=False):
3f51ca
-- 
3f51ca
2.9.5
3f51ca