-- 
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 6842d2c1d068853f16f42df893112cb1e8d716ff Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Mon, 1 Feb 2016 11:34:11 +0100
Subject: [PATCH] Updated connect/disconnect replica to work with both
 domainlevels

---
 ipatests/test_integration/tasks.py | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 27d2449ec71e0bf55a576cc495175a5ae41da1d6..318c8c880fe0df22c9b5089cbd88e017936e4df5 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -604,14 +604,31 @@ def sync_time(host, server):
     host.run_command(['ntpdate', server.hostname])
 
 
-def connect_replica(master, replica):
-    kinit_admin(replica)
-    replica.run_command(['ipa-replica-manage', 'connect', master.hostname])
+def connect_replica(master, replica, domain_level=None):
+    if domain_level is None:
+        domain_level = master.config.domain_level
+    if domain_level == DOMAIN_LEVEL_0:
+        replica.run_command(['ipa-replica-manage', 'connect', master.hostname])
+    else:
+        kinit_admin(master)
+        master.run_command(["ipa", "topologysegment-add", DOMAIN_SUFFIX_NAME,
+                            "%s-to-%s" % (master.hostname, replica.hostname),
+                            "--leftnode=%s" % master.hostname,
+                            "--rightnode=%s" % replica.hostname
+                            ])
 
 
-def disconnect_replica(master, replica):
-    kinit_admin(replica)
-    replica.run_command(['ipa-replica-manage', 'disconnect', master.hostname])
+def disconnect_replica(master, replica, domain_level=None):
+    if domain_level is None:
+        domain_level = master.config.domain_level
+    if domain_level == DOMAIN_LEVEL_0:
+        replica.run_command(['ipa-replica-manage', 'disconnect', master.hostname])
+    else:
+        kinit_admin(master)
+        master.run_command(["ipa", "topologysegment-del", DOMAIN_SUFFIX_NAME,
+                            "%s-to-%s" % (master.hostname, replica.hostname),
+                            "--continue"
+                            ])
 
 
 def kinit_admin(host):
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to