diff options
Diffstat (limited to 'ipatests/test_integration/tasks.py')
-rw-r--r-- | ipatests/test_integration/tasks.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index c2129708b..f6390377d 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -1153,3 +1153,25 @@ def uninstall_replica(master, replica): "-p", master.config.dirman_password, replica.hostname], raiseonerr=False) uninstall_master(replica) + + +def replicas_cleanup(func): + """ + replicas_cleanup decorator, applied to any test method in integration tests + uninstalls all replicas in the topology leaving only master + configured + """ + def wrapped(*args): + func(*args) + for host in args[0].replicas: + uninstall_replica(args[0].master, host) + uninstall_client(host) + result = args[0].master.run_command( + ["ipa", "host-del", "--updatedns", host.hostname], + raiseonerr=False) + # Workaround for 5627 + if "host not found" in result.stderr_text: + args[0].master.run_command(["ipa", + "host-del", + host.hostname], raiseonerr=False) + return wrapped |