fix: make type conversions work correctly (related #14487) (#14489)

Signed-off-by: kurokobo <2920259+kurokobo@users.noreply.github.com>
Co-authored-by: Alan Rominger <arominge@redhat.com>
This commit is contained in:
kurokobo
2023-09-30 13:02:10 +09:00
committed by GitHub
parent 1d340c5b4e
commit 05582702c6
2 changed files with 39 additions and 1 deletions

View File

@@ -89,7 +89,7 @@ def coerce_type(module, value):
if not HAS_YAML:
module.fail_json(msg="yaml is not installed, try 'pip install pyyaml'")
return yaml.safe_load(value)
elif value.lower in ('true', 'false', 't', 'f'):
elif value.lower() in ('true', 'false', 't', 'f'):
return {'t': True, 'f': False}[value[0].lower()]
try:
return int(value)