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 <flo@redhat.com>
Reviewed-By: Sergey Orlov <sorlov@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2019-11-22 14:49:16 +01:00 committed by Christian Heimes
parent e9dd757763
commit 7dfc6e004b

View File

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