Skip to content

Commit

Permalink
idoveridegroup: Use module.params_get_type
Browse files Browse the repository at this point in the history
Use the commom parameter type handling method for parameters that accept
a value or an empty string.
  • Loading branch information
rjeffman committed Sep 25, 2023
1 parent ab8080a commit 1d55bc5
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions plugins/modules/ipaidoverridegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def main():
# present
description = ansible_module.params_get("description")
name = ansible_module.params_get("name")
gid = ansible_module.params_get("gid")
gid = ansible_module.params_get_type("gid", int)

# runtime flags
fallback_to_ldap = ansible_module.params_get("fallback_to_ldap")
Expand Down Expand Up @@ -271,19 +271,6 @@ def main():

ansible_module.params_fail_used_invalid(invalid, state)

# Ensure parameter values are valid and have proper type.
def int_or_empty_param(value, param):
if value is not None and value != "":
try:
value = int(value)
except ValueError:
ansible_module.fail_json(
msg="Invalid value '%s' for argument '%s'" % (value, param)
)
return value

gid = int_or_empty_param(gid, "gid")

# Init

changed = False
Expand Down

0 comments on commit 1d55bc5

Please sign in to comment.