[Freeipa-devel] [TEST][Patch 0023] Updated connect/disconnect replica to work on both domain levels

2016-02-01 Thread Oleg Fayans

-- 
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 6842d2c1d068853f16f42df893112cb1e8d716ff Mon Sep 17 00:00:00 2001
From: Oleg Fayans 
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

Re: [Freeipa-devel] [TEST][Patch 0023] Updated connect/disconnect replica to work on both domain levels

2016-02-01 Thread Martin Basti



On 01.02.2016 12:21, Oleg Fayans wrote:




ACK

Pushed to:
master: aa30199e0b6002aeb8c01e2561a3d55fe3f1ceb5
ipa-4-3: a8775de8aaca56a2f589d5aebe957f78ffc66c16

-- 
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