From c77b06265bfb08d85bb4bd875cdb104ce239356d Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Nov 29 2019 15:52:26 +0000 Subject: ipatests: generic uninstall should call ipa server-del At the end of any integration test, the method uninstall is called and uninstalls master, replicas and clients. Usually the master is the CA renewal master and DNSSec master, and uninstallation may fail. This commits modifies the uninstall method in order to: - call 'ipa server-del replica' before running uninstall on a replica - uninstall the replicas before uninstalling the master Fixes: https://pagure.io/freeipa/issue/7985 Signed-off-by: Florence Blanc-Renaud Reviewed-By: Christian Heimes --- diff --git a/ipatests/test_integration/base.py b/ipatests/test_integration/base.py index 07f7c15..cd28a3b 100644 --- a/ipatests/test_integration/base.py +++ b/ipatests/test_integration/base.py @@ -20,6 +20,7 @@ """Base class for FreeIPA integration tests""" import pytest +import subprocess from ipatests.pytest_ipa.integration import tasks from pytest_sourceorder import ordered @@ -97,9 +98,17 @@ class IntegrationTest: @classmethod def uninstall(cls, mh): - tasks.uninstall_master(cls.master) for replica in cls.replicas: + try: + tasks.run_server_del( + cls.master, replica.hostname, force=True, + ignore_topology_disconnect=True, ignore_last_of_role=True) + except subprocess.CalledProcessError: + # If the master has already been uninstalled, + # this call may fail + pass tasks.uninstall_master(replica) + tasks.uninstall_master(cls.master) for client in cls.clients: tasks.uninstall_client(client) if cls.fips_mode: