This patch should fix teardown methods in replication-related CI tests ran at non-zero domain level.

--
Martin^3 Babinsky
From 52919ed0237c4bf6fe5580a9d99af79661a9bf53 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Fri, 4 Dec 2015 18:24:31 +0100
Subject: [PATCH] CI tests: ignore disconnected domain level 1 topology on IPA
 master teardown

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

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index e75fe505f5ad9b5ffe680f7e37dec6873616ca05..071a2952e9927fab9347aa855aa8f124227d2de1 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -30,6 +30,7 @@ import dns
 from ldif import LDIFWriter
 from six import StringIO
 
+from env_config import get_global_config
 from ipapython import ipautil
 from ipaplatform.paths import paths
 from ipapython.dn import DN
@@ -38,12 +39,13 @@ from ipatests.test_integration import util
 from ipatests.test_integration.env_config import env_to_script
 from ipatests.test_integration.host import Host
 from ipalib.util import get_reverse_zone_default
-from ipalib.constants import DOMAIN_SUFFIX_NAME
+from ipalib.constants import  DOMAIN_LEVEL_0, DOMAIN_SUFFIX_NAME
 
 log = log_mgr.get_logger(__name__)
 
 IPATEST_NM_CONFIG = '20-ipatest-unmanaged-resolv.conf'
 
+CONFIGURED_DOMAIN_LEVEL = get_global_config().domain_level
 
 def check_arguments_are(slice, instanceof):
     """
@@ -342,7 +344,7 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
             '--setup-dns',
             '--forwarder', replica.config.dns_forwarder
         ])
-    if domainlevel(master) == 0:
+    if domainlevel(master) == DOMAIN_LEVEL_0:
         apply_common_fixes(replica)
         # prepare the replica file on master and put it to replica, AKA "old way"
         replica_prepare(master, replica)
@@ -364,7 +366,7 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
             "-p", replica.config.dirman_password,
             "-U",
         ]
-        if domainlevel(master) == 0:
+        if domainlevel(master) == DOMAIN_LEVEL_0:
             args.append(replica_filename)
         replica.run_command(args)
 
@@ -614,11 +616,16 @@ def kinit_admin(host):
                      stdin_text=host.config.admin_password)
 
 
-def uninstall_master(host):
+def uninstall_master(host, ignore_topology_disconnect=True):
     host.collect_log(paths.IPASERVER_UNINSTALL_LOG)
+    uninstall_cmd = ['ipa-server-install', '--uninstall', '-U']
 
-    host.run_command(['ipa-server-install', '--uninstall', '-U'],
-                     raiseonerr=False)
+    host_domain_level = domainlevel(host)
+
+    if ignore_topology_disconnect and host_domain_level != DOMAIN_LEVEL_0:
+        uninstall_cmd.append('--ignore-topology-disconnect')
+
+    host.run_command(uninstall_cmd, raiseonerr=False)
     host.run_command(['pkidestroy', '-s', 'CA', '-i', 'pki-tomcat'],
                      raiseonerr=False)
     host.run_command(['rm', '-rf',
-- 
2.5.0

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