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
3d6bf871
Unverified
Commit
3d6bf871
authored
Sep 16, 2021
by
Thomas Woerner
Committed by
GitHub
Sep 16, 2021
Browse files
Options
Downloads
Plain Diff
Merge pull request #637 from rjeffman/ipaconfig_missing_params
config: Fix data returned from module.
parents
2da03cb8
87de471d
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/ipaconfig.py
+27
-30
27 additions, 30 deletions
plugins/modules/ipaconfig.py
with
27 additions
and
30 deletions
plugins/modules/ipaconfig.py
+
27
−
30
View file @
3d6bf871
...
...
@@ -252,7 +252,7 @@ from ansible.module_utils.ansible_freeipa_module import \
def
config_show
(
module
):
_result
=
module
.
ipa_command_no_name
(
"
config_show
"
,
{})
_result
=
module
.
ipa_command_no_name
(
"
config_show
"
,
{
"
all
"
:
True
})
return
_result
[
"
result
"
]
...
...
@@ -388,19 +388,18 @@ def main():
changed
=
False
exit_args
=
{}
res_show
=
None
# Connect to IPA API
with
ansible_module
.
ipa_connect
():
result
=
config_show
(
ansible_module
)
if
params
:
res_show
=
config_show
(
ansible_module
)
params
=
{
k
:
v
for
k
,
v
in
params
.
items
()
if
k
not
in
res
_show
or
res
_show
[
k
]
!=
v
if
k
not
in
res
ult
or
res
ult
[
k
]
!=
v
}
if
params
\
and
not
compare_args_ipa
(
ansible_module
,
params
,
res
_show
):
and
not
compare_args_ipa
(
ansible_module
,
params
,
res
ult
):
changed
=
True
if
not
ansible_module
.
check_mode
:
try
:
...
...
@@ -409,38 +408,36 @@ def main():
except
ipalib_errors
.
EmptyModlist
:
changed
=
False
else
:
rawresult
=
ansible_module
.
ipa_command_no_name
(
"
config_show
"
,
{})
result
=
rawresult
[
'
result
'
]
del
result
[
'
dn
'
]
type_map
=
{
"
str
"
:
str
,
"
int
"
:
int
,
"
list
"
:
list
,
"
bool
"
:
bool
}
for
key
,
value
in
result
.
items
():
k
=
reverse_field_map
.
get
(
key
,
key
)
if
ansible_module
.
argument_spec
.
get
(
k
):
if
k
==
'
ipaselinuxusermaporder
'
:
exit_args
[
'
ipaselinuxusermaporder
'
]
=
\
result
.
get
(
key
)[
0
].
split
(
'
$
'
)
elif
k
==
'
domain_resolution_order
'
:
exit_args
[
'
domain_resolution_order
'
]
=
\
result
.
get
(
key
)[
0
].
split
(
'
$
'
)
elif
k
==
'
usersearch
'
:
exit_args
[
'
usersearch
'
]
=
\
result
.
get
(
key
)[
0
].
split
(
'
,
'
)
elif
k
==
'
groupsearch
'
:
exit_args
[
'
groupsearch
'
]
=
\
result
.
get
(
key
)[
0
].
split
(
'
,
'
)
elif
isinstance
(
value
,
str
)
and
\
ansible_module
.
argument_spec
[
k
][
'
type
'
]
==
"
list
"
:
arg_type
=
ansible_module
.
argument_spec
[
k
][
'
type
'
]
if
k
in
(
'
ipaselinuxusermaporder
'
,
'
domain_resolution_order
'
):
exit_args
[
k
]
=
result
.
get
(
key
)[
0
].
split
(
'
$
'
)
elif
k
in
(
'
usersearch
'
,
'
groupsearch
'
):
exit_args
[
k
]
=
result
.
get
(
key
)[
0
].
split
(
'
,
'
)
elif
isinstance
(
value
,
str
)
and
arg_type
==
"
list
"
:
exit_args
[
k
]
=
[
value
]
elif
isinstance
(
value
,
list
)
and
\
ansible_module
.
argument_spec
[
k
][
'
type
'
]
==
"
str
"
:
exit_args
[
k
]
=
"
,
"
.
join
(
value
)
elif
isinstance
(
value
,
list
)
and
\
ansible_module
.
argument_spec
[
k
][
'
type
'
]
==
"
int
"
:
exit_args
[
k
]
=
"
,
"
.
join
(
value
)
elif
isinstance
(
value
,
list
)
and
\
ansible_module
.
argument_spec
[
k
][
'
type
'
]
==
"
bool
"
:
elif
(
isinstance
(
value
,
(
tuple
,
list
))
and
arg_type
in
(
"
str
"
,
"
int
"
)
):
exit_args
[
k
]
=
type_map
[
arg_type
](
value
[
0
])
elif
(
isinstance
(
value
,
(
tuple
,
list
)
)
and
arg_type
==
"
bool
"
)
:
exit_args
[
k
]
=
(
value
[
0
]
==
"
TRUE
"
)
else
:
exit_args
[
k
]
=
value
if
arg_type
not
in
type_map
:
raise
ValueError
(
"
Unexpected attribute type: %s
"
%
arg_type
)
exit_args
[
k
]
=
type_map
[
arg_type
](
value
)
# Done
ansible_module
.
exit_json
(
changed
=
changed
,
config
=
exit_args
)
...
...
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
sign in
to comment