Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set 'value' type to noop validator #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benjamb
Copy link
Contributor

@benjamb benjamb commented May 25, 2022

If the type of an argument is not set, ansible defaults to treating it
as a string. As such it gets run through a validator that converts the
value to a string via str().

In the case of 'value' being null, or perhaps a dict or list that
contained null, the conversion via str() would cause the python native
None to be passed to this module, which when parsed through
yaml.safe_load() in parse_value(), would return the string 'None'.

To fix this, we set the type of 'value' to a noop validator, as the type
may vary and we don't want ansible to perform any conversion.

If the type of an argument is not set, ansible defaults to treating it
as a string. As such it gets run through a validator that converts the
value to a string via str().

In the case of 'value' being `null`, or perhaps a dict or list that
contained `null`, the conversion via str() would cause the python native
`None` to be passed to this module, which when parsed through
yaml.safe_load() in parse_value(), would return the string `'None'`.

To fix this, we set the type of 'value' to a noop validator, as the type
may vary and we don't want ansible to perform any conversion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant