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

host: Use IPAAnsibleModule method to validate arguments.

Use the IPAAnsibleModule.params_fail_if_used method to validate
arguments provided by user.
parent 952f62cd
Branches
Tags
No related merge requests found
...@@ -530,6 +530,7 @@ def check_parameters( # pylint: disable=unused-argument ...@@ -530,6 +530,7 @@ def check_parameters( # pylint: disable=unused-argument
userclass, auth_ind, requires_pre_auth, ok_as_delegate, userclass, auth_ind, requires_pre_auth, ok_as_delegate,
ok_to_auth_as_delegate, force, reverse, ip_address, update_dns, ok_to_auth_as_delegate, force, reverse, ip_address, update_dns,
update_password): update_password):
invalid = []
if state == "present": if state == "present":
if action == "member": if action == "member":
# certificate, managedby_host, principal, # certificate, managedby_host, principal,
...@@ -539,11 +540,6 @@ def check_parameters( # pylint: disable=unused-argument ...@@ -539,11 +540,6 @@ def check_parameters( # pylint: disable=unused-argument
"userclass", "auth_ind", "requires_pre_auth", "userclass", "auth_ind", "requires_pre_auth",
"ok_as_delegate", "ok_to_auth_as_delegate", "force", "ok_as_delegate", "ok_to_auth_as_delegate", "force",
"reverse", "update_dns", "update_password"] "reverse", "update_dns", "update_password"]
for x in invalid:
if vars()[x] is not None:
module.fail_json(
msg="Argument '%s' can not be used with action "
"'%s'" % (x, action))
if state == "absent": if state == "absent":
invalid = ["description", "locality", "location", "platform", "os", invalid = ["description", "locality", "location", "platform", "os",
...@@ -551,11 +547,6 @@ def check_parameters( # pylint: disable=unused-argument ...@@ -551,11 +547,6 @@ def check_parameters( # pylint: disable=unused-argument
"userclass", "auth_ind", "requires_pre_auth", "userclass", "auth_ind", "requires_pre_auth",
"ok_as_delegate", "ok_to_auth_as_delegate", "force", "ok_as_delegate", "ok_to_auth_as_delegate", "force",
"reverse", "update_password"] "reverse", "update_password"]
for x in invalid:
if vars()[x] is not None:
module.fail_json(
msg="Argument '%s' can not be used with state '%s'" %
(x, state))
if action == "host": if action == "host":
invalid = [ invalid = [
"certificate", "managedby_host", "principal", "certificate", "managedby_host", "principal",
...@@ -565,11 +556,8 @@ def check_parameters( # pylint: disable=unused-argument ...@@ -565,11 +556,8 @@ def check_parameters( # pylint: disable=unused-argument
"allow_retrieve_keytab_host", "allow_retrieve_keytab_host",
"allow_retrieve_keytab_hostgroup" "allow_retrieve_keytab_hostgroup"
] ]
for x in invalid:
if vars()[x] is not None: module.params_fail_used_invalid(invalid, state, action)
module.fail_json(
msg="Argument '%s' can only be used with action "
"'member' for state '%s'" % (x, state))
# pylint: disable=unused-argument # pylint: disable=unused-argument
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment