Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FusionIAM
FusionIAM
Commits
c70d9d06
Commit
c70d9d06
authored
Jul 08, 2021
by
Clément OUDOT
Browse files
Possibility to set separator in lemonldap-ng-cli
parent
0f44f068
Changes
1
Hide whitespace changes
Inline
Side-by-side
build/centos8/lemonldap-ng/ansible/library/lemonldap_config.py
View file @
c70d9d06
...
...
@@ -27,9 +27,14 @@ options:
description:
- Value of the configuration to enforce
required: true
sep:
description:
- Separator value
required: false
author:
- Maxime Besson
- Worteks
'''
EXAMPLES
=
'''
...
...
@@ -59,6 +64,7 @@ def run_module():
module_args
=
dict
(
name
=
dict
(
type
=
'str'
,
required
=
True
),
value
=
dict
(
type
=
'str'
,
required
=
True
),
sep
=
dict
(
type
=
'str'
,
required
=
False
,
default
=
'/'
),
)
# seed the result dict in the object
...
...
@@ -82,6 +88,7 @@ def run_module():
key_name
=
module
.
params
[
'name'
]
new_value
=
module
.
params
[
'value'
]
sep
=
module
.
params
[
'sep'
]
result
[
'name'
]
=
key_name
result
[
'new_value'
]
=
new_value
...
...
@@ -114,12 +121,12 @@ def run_module():
module
.
exit_json
(
**
result
)
# Else, modify config
if
'/'
in
key_name
:
(
key_base
,
_
,
subkey
)
=
key_name
.
rpartition
(
"/"
)
if
sep
in
key_name
:
(
key_base
,
_
,
subkey
)
=
key_name
.
rpartition
(
sep
)
# use addKey
change
=
Popen
(
[
'/usr/libexec/lemonldap-ng/bin/lemonldap-ng-cli'
,
'-yes'
,
'1'
,
'-safe'
,
'1'
,
'addKey'
,
key_base
,
subkey
,
new_value
],
'-yes'
,
'1'
,
'-safe'
,
'1'
,
'-sep'
,
sep
,
'addKey'
,
key_base
,
subkey
,
new_value
],
stdout
=
PIPE
,
stderr
=
PIPE
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment