mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-30 19:34:45 +00:00
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.
This commit is contained in:
@@ -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
|
):
|
||||||
]
|
module.fail_json(
|
||||||
if unsupported:
|
msg="Your IPA version does not support arguments: "
|
||||||
module.fail_json(
|
"maxrepeat, maxsequence, dictcheck, usercheck.")
|
||||||
msg="Your IPA version does not support arguments: "
|
|
||||||
"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'.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user