mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-25 00:44:42 +00:00
templates: Use IPAAnsibleModule params_fail_used_invalid.
Modify new module templates to use IPAAnsibleModule method `params_fail_used_invalid` to check for invalid parameter use for a given state/action.
This commit is contained in:
@@ -185,11 +185,7 @@ def main():
|
|||||||
if action == "$name":
|
if action == "$name":
|
||||||
invalid.append("PARAMETER2")
|
invalid.append("PARAMETER2")
|
||||||
|
|
||||||
for x in invalid:
|
ansible_module.params_fail_used_invalid(invalid, state, action)
|
||||||
if vars()[x] is not None:
|
|
||||||
ansible_module.fail_json(
|
|
||||||
msg="Argument '%s' can not be used with action "
|
|
||||||
"'%s' and state '%s'" % (x, action, state))
|
|
||||||
|
|
||||||
# Init
|
# Init
|
||||||
|
|
||||||
|
|||||||
@@ -151,11 +151,7 @@ def main():
|
|||||||
ansible_module.fail_json(msg="No name given.")
|
ansible_module.fail_json(msg="No name given.")
|
||||||
invalid = ["PARAMETER1", "PARAMETER2"]
|
invalid = ["PARAMETER1", "PARAMETER2"]
|
||||||
|
|
||||||
for x in invalid:
|
ansible_module.params_fail_used_invalid(invalid, state)
|
||||||
if vars()[x] is not None:
|
|
||||||
ansible_module.fail_json(
|
|
||||||
msg="Argument '%s' can not be used with state '%s'" %
|
|
||||||
(x, state))
|
|
||||||
|
|
||||||
# Init
|
# Init
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user