From 3e81b0f3b13db296937b51f971d0db756b6963d1 Mon Sep 17 00:00:00 2001 From: Sergey Orlov Date: Apr 03 2020 16:59:23 +0000 Subject: ipatests: add utility for getting sssd version on remote host This function should be used to conditionally skip tests or mark them xfail when installed version of sssd does not yet contain patch for the tested issue. Reviewed-By: Florence Blanc-Renaud --- diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py index 5fb1988..f19728c 100755 --- a/ipatests/pytest_ipa/integration/tasks.py +++ b/ipatests/pytest_ipa/integration/tasks.py @@ -34,6 +34,7 @@ import time from pipes import quote import configparser from contextlib import contextmanager +from pkg_resources import parse_version import dns from ldif import LDIFWriter @@ -2174,3 +2175,9 @@ def wait_for_sssd_domain_status_online(host, timeout=120): time.sleep(5) else: raise RuntimeError("SSSD still offline") + + +def get_sssd_version(host): + """Get sssd version on remote host.""" + version = host.run_command('sssd --version').stdout_text.strip() + return parse_version(version)