Skip to content
Snippets Groups Projects
Commit 4df2cab4 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

module templates: Add delete_commit code template.

This patch add the lines necessary to allow the use of the attribute
`delete_continue`, as it is a commom attribute, and if newer commom
attributes are added to IPAAnsibleModule in the future, the usage will
be similar.
parent 5d6324e2
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ short description: Manage FreeIPA $name
description: Manage FreeIPA $name and $name members
extends_documentation_fragment:
- ipamodule_base_docs
- ipamoudle_base_docs.delete_continue
options:
name:
description: The list of $name name strings.
......@@ -152,6 +153,7 @@ def main():
choices=["present", "absent"]),
),
supports_check_mode=True,
ipa_module_options=["delete_continue"]
)
ansible_module._ansible_debug = True
......@@ -169,6 +171,8 @@ def main():
PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2")
action = ansible_module.params_get("action")
delete_continue = ansible_module.params_get("delete_continue")
# state
state = ansible_module.params_get("state")
......@@ -249,7 +253,9 @@ def main():
elif state == "absent":
if action == "$name":
if res_find is not None:
commands.append([name, "$name_del", {}])
commands.append(
[name, "$name_del", {"continue": delete_continue}]
)
elif action == "member":
if res_find is None:
......@@ -275,10 +281,12 @@ def main():
}])
# Remove members
if PARAMETER2_del:
commands.append([name, "$name_remove_member",
{
"PARAMETER2": PARAMETER2_del,
"continue": delete_continue,
}])
# Execute commands
......
......@@ -36,6 +36,7 @@ short description: Manage FreeIPA $name
description: Manage FreeIPA $name
extends_documentation_fragment:
- ipamodule_base_docs
- ipamodule_base_docs.delete_continue
options:
name:
description: The list of $name name strings.
......@@ -124,6 +125,7 @@ def main():
choices=["present", "absent"]),
),
supports_check_mode=True,
ipa_module_options=["delete_continue"],
)
ansible_module._ansible_debug = True
......@@ -140,6 +142,8 @@ def main():
# these parameters, use IPAAnsibleModule.params_get_lowercase.
PARAMETER2 = ansible_module.params_get_lowercase("PARAMETER2")
delete_continue = ansible_module.params_get("delete_continue")
# state
state = ansible_module.params_get("state")
......@@ -191,7 +195,9 @@ def main():
elif state == "absent":
if res_find is not None:
commands.append([name, "$name_del", {}])
commands.append(
[name, "$name_del", {"continue": delete_continue}]
)
else:
ansible_module.fail_json(msg="Unkown state '%s'" % state)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment