Skip to content
Snippets Groups Projects
Commit a6944602 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

ipapwpolicy: simplified and faster attribute verification

Use a simpler and faster 'any()' test instead of creating two lists and
checking if resulting list is empty.
parent cf27a98c
No related branches found
No related tags found
No related merge requests found
...@@ -230,17 +230,15 @@ def check_supported_params( ...@@ -230,17 +230,15 @@ def check_supported_params(
"pwpolicy_add", "passwordgracelimit") "pwpolicy_add", "passwordgracelimit")
# If needed, report unsupported password checking paramteres # If needed, report unsupported password checking paramteres
if not has_password_check: if (
check_password_params = [maxrepeat, maxsequence, dictcheck, usercheck] not has_password_check
unsupported = [ and any([maxrepeat, maxsequence, dictcheck, usercheck])
x for x in check_password_params if x is not None ):
]
if unsupported:
module.fail_json( module.fail_json(
msg="Your IPA version does not support arguments: " msg="Your IPA version does not support arguments: "
"maxrepeat, maxsequence, dictcheck, usercheck.") "maxrepeat, maxsequence, dictcheck, usercheck.")
if gracelimit is not None and not has_gracelimit: if not has_gracelimit and gracelimit is not None:
module.fail_json( module.fail_json(
msg="Your IPA version does not support 'gracelimit'.") msg="Your IPA version does not support 'gracelimit'.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment