ipapermission: add version check for bind type 'self'

FreeIPA 4.8.7 has introduced bind type 'self' as a valid value, and
this PR adds checks so the module fails early if the value is used
with an unsupported version.

Tests and documentation have been updated to reflect the changes.
This commit is contained in:
Rafael Guterres Jeffman
2020-11-13 15:26:36 -03:00
parent 2aaabc77c4
commit b6cf3e5f51
3 changed files with 41 additions and 13 deletions

View File

@@ -152,7 +152,8 @@ RETURN = """
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ansible_freeipa_module import \
temp_kinit, temp_kdestroy, valid_creds, api_connect, api_command, \
compare_args_ipa, module_params_get, gen_add_del_lists
compare_args_ipa, module_params_get, gen_add_del_lists, \
api_check_ipa_version
import six
if six.PY3:
@@ -336,6 +337,10 @@ def main():
msg="Argument '%s' can not be used with action "
"'%s' and state '%s'" % (x, action, state))
if bindtype == "self" and api_check_ipa_version("<", "4.8.7"):
ansible_module.fail_json(
msg="Bindtype 'self' is not supported by your IPA version.")
# Init
changed = False