mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix to make sure only strings are being joined
Since BOOLEANS also contains integers, joining the list returns an error. Easy to test by giving a wrong value to a boolean argument: service name=httpd enabled=True Since True is not in the allowed BOOLEANS, it will cause the error, which in its turn bails out because it joins strings and integers. We may want to remove the integers from the choices since '0' and '1' are already in the list as strings. Personally I would expect only strings as arguments, not sure where these could be integers ??
This commit is contained in:
parent
06cfc52afd
commit
27b2ae8ddc
1 changed files with 1 additions and 1 deletions
|
@ -173,7 +173,7 @@ class AnsibleModule(object):
|
||||||
if type(choices) == list:
|
if type(choices) == list:
|
||||||
if k in self.params:
|
if k in self.params:
|
||||||
if self.params[k] not in choices:
|
if self.params[k] not in choices:
|
||||||
choices_str=",".join(choices)
|
choices_str=",".join([str(c) for c in choices])
|
||||||
msg="value of %s must be one of: %s, got: %s" % (k, choices_str, self.params[k])
|
msg="value of %s must be one of: %s, got: %s" % (k, choices_str, self.params[k])
|
||||||
self.fail_json(msg=msg)
|
self.fail_json(msg=msg)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue