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)
This commit is contained in:
Thomas Woerner
2019-04-04 17:20:15 +02:00
parent 25495d1e40
commit 818db5cb4d
2 changed files with 7 additions and 2 deletions

View File

@@ -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 ###

View File

@@ -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: