From 818db5cb4dc5e3b89ba6575bcdf67277c6d2c974 Mon Sep 17 00:00:00 2001 From: Thomas Woerner <twoerner@redhat.com> Date: Thu, 4 Apr 2019 17:20:15 +0200 Subject: [PATCH] ipa[client,server]: Inspect validate_domain_name for 4.6 and prior The entity argument for validate_domain_name is only available in FreeIPA 4.7 and later. This has been fixed using inspect to be able to detect if entity is a valid argument. If not the whole realm name check is skipped. Related: #61 (ipaserver role - Fails on ipaclient install) Fixes: #66 (Python 2 error with validate_domain) --- roles/ipaclient/library/ipaclient_test.py | 5 ++++- roles/ipaserver/library/ipaserver_test.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/ipaclient/library/ipaclient_test.py b/roles/ipaclient/library/ipaclient_test.py index 457857b2..54bc2dfb 100644 --- a/roles/ipaclient/library/ipaclient_test.py +++ b/roles/ipaclient/library/ipaclient_test.py @@ -327,7 +327,10 @@ def main(): validate_domain_name(options.domain_name) if options.realm_name: - validate_domain_name(options.realm_name, entity="realm") + argspec = inspect.getargspec(validate_domain_name) + if "entity" in argspec.args: + # NUM_VERSION >= 40690: + validate_domain_name(options.realm_name, entity="realm") ### ClientInstallInterface ### diff --git a/roles/ipaserver/library/ipaserver_test.py b/roles/ipaserver/library/ipaserver_test.py index 81719885..c9f7cce2 100644 --- a/roles/ipaserver/library/ipaserver_test.py +++ b/roles/ipaserver/library/ipaserver_test.py @@ -565,7 +565,9 @@ def main(): if not options.realm_name: options.realm_name = options.domain_name options.realm_name = options.realm_name.upper() - if NUM_VERSION >= 40690: + argspec = inspect.getargspec(validate_domain_name) + if "entity" in argspec.args: + # NUM_VERSION >= 40690: try: validate_domain_name(options.realm_name, entity="realm") except ValueError as e: -- GitLab