ipatests: do not finalize api when IPA is not configured

Pytest can be executed from a machine that doesn't have IPA configured.
In this case, api can't be finalized because values such as basedn are
unknown and missing.

Fixes https://pagure.io/freeipa/issue/7046

Signed-off-by: Tomas Krizek <tkrizek@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Tomas Krizek 2017-07-10 14:43:18 +02:00
parent c565fa1781
commit 7f8d79f637
No known key found for this signature in database
GPG Key ID: 22A2A94B5E49415A

View File

@ -18,6 +18,7 @@ except ImportError:
ipaplatform = None
try:
import ipaserver
from ipaserver.install import installutils
except ImportError:
ipaserver = None
@ -105,7 +106,7 @@ def pytest_cmdline_main(config):
# XXX workaround until https://fedorahosted.org/freeipa/ticket/6408 has
# been resolved.
if ipaserver is not None:
if ipaserver is not None and installutils.is_ipa_configured():
api.finalize()
if config.option.verbose: