Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible FreeIPA
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Ansible FreeIPA
Commits
7b470ceb
Unverified
Commit
7b470ceb
authored
2 years ago
by
Rafael Guterres Jeffman
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1022 from t-woerner/pwpolicy_bool_checks
pwpolicy: Fix new bool checks for IPA prior to 4.9.10
parents
77f5d875
9108065e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/modules/ipapwpolicy.py
+19
-7
19 additions, 7 deletions
plugins/modules/ipapwpolicy.py
with
19 additions
and
7 deletions
plugins/modules/ipapwpolicy.py
+
19
−
7
View file @
7b470ceb
...
@@ -171,7 +171,8 @@ def find_pwpolicy(module, name):
...
@@ -171,7 +171,8 @@ def find_pwpolicy(module, name):
return
None
return
None
def
gen_args
(
maxlife
,
minlife
,
history
,
minclasses
,
minlength
,
priority
,
def
gen_args
(
module
,
maxlife
,
minlife
,
history
,
minclasses
,
minlength
,
priority
,
maxfail
,
failinterval
,
lockouttime
,
maxrepeat
,
maxsequence
,
maxfail
,
failinterval
,
lockouttime
,
maxrepeat
,
maxsequence
,
dictcheck
,
usercheck
,
gracelimit
):
dictcheck
,
usercheck
,
gracelimit
):
_args
=
{}
_args
=
{}
...
@@ -198,8 +199,18 @@ def gen_args(maxlife, minlife, history, minclasses, minlength, priority,
...
@@ -198,8 +199,18 @@ def gen_args(maxlife, minlife, history, minclasses, minlength, priority,
if
maxsequence
is
not
None
:
if
maxsequence
is
not
None
:
_args
[
"
ipapwdmaxrsequence
"
]
=
maxsequence
_args
[
"
ipapwdmaxrsequence
"
]
=
maxsequence
if
dictcheck
is
not
None
:
if
dictcheck
is
not
None
:
if
module
.
ipa_check_version
(
"
<
"
,
"
4.9.10
"
):
# Allowed values: "TRUE", "FALSE", ""
_args
[
"
ipapwddictcheck
"
]
=
"
TRUE
"
if
dictcheck
is
True
else
\
"
FALSE
"
if
dictcheck
is
False
else
dictcheck
else
:
_args
[
"
ipapwddictcheck
"
]
=
dictcheck
_args
[
"
ipapwddictcheck
"
]
=
dictcheck
if
usercheck
is
not
None
:
if
usercheck
is
not
None
:
if
module
.
ipa_check_version
(
"
<
"
,
"
4.9.10
"
):
# Allowed values: "TRUE", "FALSE", ""
_args
[
"
ipapwdusercheck
"
]
=
"
TRUE
"
if
usercheck
is
True
else
\
"
FALSE
"
if
usercheck
is
False
else
usercheck
else
:
_args
[
"
ipapwdusercheck
"
]
=
usercheck
_args
[
"
ipapwdusercheck
"
]
=
usercheck
if
gracelimit
is
not
None
:
if
gracelimit
is
not
None
:
_args
[
"
passwordgracelimit
"
]
=
gracelimit
_args
[
"
passwordgracelimit
"
]
=
gracelimit
...
@@ -349,7 +360,7 @@ def main():
...
@@ -349,7 +360,7 @@ def main():
maxsequence
=
int_or_empty_param
(
maxsequence
,
"
maxsequence
"
)
maxsequence
=
int_or_empty_param
(
maxsequence
,
"
maxsequence
"
)
gracelimit
=
int_or_empty_param
(
gracelimit
,
"
gracelimit
"
)
gracelimit
=
int_or_empty_param
(
gracelimit
,
"
gracelimit
"
)
def
bool_param
(
value
,
param
):
# pylint: disable=R1710
def
bool_
or_empty_
param
(
value
,
param
):
# pylint: disable=R1710
# As of Ansible 2.14, values True, False, Yes an No, with variable
# As of Ansible 2.14, values True, False, Yes an No, with variable
# capitalization are accepted by Ansible.
# capitalization are accepted by Ansible.
if
not
value
:
if
not
value
:
...
@@ -362,8 +373,8 @@ def main():
...
@@ -362,8 +373,8 @@ def main():
msg
=
"
Invalid value
'
%s
'
for argument
'
%s
'
.
"
%
(
value
,
param
)
msg
=
"
Invalid value
'
%s
'
for argument
'
%s
'
.
"
%
(
value
,
param
)
)
)
dictcheck
=
bool_param
(
dictcheck
,
"
dictcheck
"
)
dictcheck
=
bool_
or_empty_
param
(
dictcheck
,
"
dictcheck
"
)
usercheck
=
bool_param
(
usercheck
,
"
usercheck
"
)
usercheck
=
bool_
or_empty_
param
(
usercheck
,
"
usercheck
"
)
# Ensure gracelimit has proper limit.
# Ensure gracelimit has proper limit.
if
gracelimit
:
if
gracelimit
:
...
@@ -392,7 +403,8 @@ def main():
...
@@ -392,7 +403,8 @@ def main():
# Create command
# Create command
if
state
==
"
present
"
:
if
state
==
"
present
"
:
# Generate args
# Generate args
args
=
gen_args
(
maxlife
,
minlife
,
history
,
minclasses
,
args
=
gen_args
(
ansible_module
,
maxlife
,
minlife
,
history
,
minclasses
,
minlength
,
priority
,
maxfail
,
failinterval
,
minlength
,
priority
,
maxfail
,
failinterval
,
lockouttime
,
maxrepeat
,
maxsequence
,
dictcheck
,
lockouttime
,
maxrepeat
,
maxsequence
,
dictcheck
,
usercheck
,
gracelimit
)
usercheck
,
gracelimit
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment