mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipatests: tasks.py: add wait_for_ipa_to_start
wait_for_ipa_to_start(host) waits for ipactl to return RUNNING for all IPA services on the specified host. Related: https://pagure.io/freeipa/issue/8534 Signed-off-by: François Cami <fcami@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
This commit is contained in:
committed by
Florence Blanc-Renaud
parent
2c83b1e713
commit
ef752bf208
@@ -47,6 +47,7 @@ from cryptography import x509
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from ipapython import certdb
|
||||
from ipapython import ipautil
|
||||
@@ -2587,6 +2588,26 @@ def get_healthcheck_version(host):
|
||||
return healthcheck_version
|
||||
|
||||
|
||||
def wait_for_ipa_to_start(host, timeout=60):
|
||||
"""Wait up to timeout seconds for ipa to start on a given host.
|
||||
|
||||
If DS is restarted, and SSSD must be online, please consider using
|
||||
wait_for_sssd_domain_status_online(host) in the test after calling
|
||||
this method.
|
||||
"""
|
||||
interval = 1
|
||||
end_time = datetime.now() + timedelta(seconds=timeout)
|
||||
for _i in range(0, timeout, interval):
|
||||
if datetime.now() > end_time:
|
||||
raise RuntimeError("Request timed out")
|
||||
time.sleep(interval)
|
||||
result = host.run_command(
|
||||
[paths.IPACTL, "status"], raiseonerr=False
|
||||
)
|
||||
if result.returncode == 0:
|
||||
break
|
||||
|
||||
|
||||
def run_ssh_cmd(
|
||||
from_host=None, to_host=None, username=None, cmd=None,
|
||||
auth_method=None, password=None, private_key_path=None,
|
||||
|
||||
Reference in New Issue
Block a user