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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Ansible FreeIPA
Commits
d615d3d4
Unverified
Commit
d615d3d4
authored
Nov 25, 2021
by
Thomas Woerner
Committed by
GitHub
Nov 25, 2021
Browse files
Options
Downloads
Plain Diff
Merge pull request #675 from rjeffman/automember_idempotence_issue
automember: Fix behavior of unused parameters.
parents
77b72af1
17bba27a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/modules/ipaautomember.py
+15
-9
15 additions, 9 deletions
plugins/modules/ipaautomember.py
tests/automember/test_automember.yml
+77
-0
77 additions, 0 deletions
tests/automember/test_automember.yml
with
92 additions
and
9 deletions
plugins/modules/ipaautomember.py
+
15
−
9
View file @
d615d3d4
...
@@ -309,15 +309,21 @@ def main():
...
@@ -309,15 +309,21 @@ def main():
commands
.
append
([
name
,
'
automember_add
'
,
args
])
commands
.
append
([
name
,
'
automember_add
'
,
args
])
res_find
=
{}
res_find
=
{}
if
inclusive
is
not
None
:
inclusive_add
,
inclusive_del
=
gen_add_del_lists
(
inclusive_add
,
inclusive_del
=
gen_add_del_lists
(
transform_conditions
(
inclusive
or
[]
),
transform_conditions
(
inclusive
),
res_find
.
get
(
"
automemberinclusiveregex
"
,
[])
res_find
.
get
(
"
automemberinclusiveregex
"
,
[])
)
)
else
:
inclusive_add
,
inclusive_del
=
[],
[]
if
exclusive
is
not
None
:
exclusive_add
,
exclusive_del
=
gen_add_del_lists
(
exclusive_add
,
exclusive_del
=
gen_add_del_lists
(
transform_conditions
(
exclusive
or
[]
),
transform_conditions
(
exclusive
),
res_find
.
get
(
"
automemberexclusiveregex
"
,
[])
res_find
.
get
(
"
automemberexclusiveregex
"
,
[])
)
)
else
:
exclusive_add
,
exclusive_del
=
[],
[]
elif
action
==
"
member
"
:
elif
action
==
"
member
"
:
if
res_find
is
None
:
if
res_find
is
None
:
...
...
This diff is collapsed.
Click to expand it.
tests/automember/test_automember.yml
+
77
−
0
View file @
d615d3d4
...
@@ -367,6 +367,83 @@
...
@@ -367,6 +367,83 @@
failed_when
:
result.changed or not result.failed or
failed_when
:
result.changed or not result.failed or
"Invalid automember condition key 'cns'" not in result.msg
"Invalid automember condition key 'cns'" not in result.msg
# Tests for issue https://bugzilla.redhat.com/show_bug.cgi?id=1976922
-
name
:
Ensure group testgroup is absent
ipaautomember
:
ipaadmin_password
:
SomeADMINpassword
ipaapi_context
:
"
{{
ipa_context
|
default(omit)
}}"
name
:
testgroup
state
:
absent
automember_type
:
group
register
:
result
failed_when
:
not result.changed or result.failed
-
name
:
Ensure group testgroup is present
ipaautomember
:
ipaadmin_password
:
SomeADMINpassword
ipaapi_context
:
"
{{
ipa_context
|
default(omit)
}}"
name
:
testgroup
description
:
Automember rule.
automember_type
:
group
inclusive
:
-
key
:
cn
expression
:
"
@1"
exclusive
:
-
key
:
cn
expression
:
s
register
:
result
failed_when
:
not result.changed or result.failed
-
name
:
Ensure group testgroup is present with updated description
ipaautomember
:
ipaadmin_password
:
SomeADMINpassword
ipaapi_context
:
"
{{
ipa_context
|
default(omit)
}}"
name
:
testgroup
description
:
New automember rule.
automember_type
:
group
register
:
result
failed_when
:
not result.changed or result.failed
-
name
:
Ensure group testgroup is present with updated description, again
ipaautomember
:
ipaadmin_password
:
SomeADMINpassword
ipaapi_context
:
"
{{
ipa_context
|
default(omit)
}}"
name
:
testgroup
description
:
New automember rule.
automember_type
:
group
register
:
result
failed_when
:
result.changed or result.failed
-
name
:
Verify inclusive and exclusive rules have not changed
ipaautomember
:
ipaadmin_password
:
SomeADMINpassword
ipaapi_context
:
"
{{
ipa_context
|
default(omit)
}}"
name
:
testgroup
automember_type
:
group
inclusive
:
-
key
:
cn
expression
:
"
@1"
exclusive
:
-
key
:
cn
expression
:
s
register
:
result
failed_when
:
result.changed or result.failed
-
name
:
Verify no other rules existed.
ipaautomember
:
ipaadmin_password
:
SomeADMINpassword
ipaapi_context
:
"
{{
ipa_context
|
default(omit)
}}"
name
:
testgroup
automember_type
:
group
inclusive
:
[]
exclusive
:
[]
action
:
member
state
:
absent
register
:
result
failed_when
:
result.changed or result.failed
# End of ests for issue https://bugzilla.redhat.com/show_bug.cgi?id=1976922
# CLEANUP TEST ITEMS
# CLEANUP TEST ITEMS
-
name
:
Ensure group testgroup is absent
-
name
:
Ensure group testgroup is absent
...
...
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