mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allow config boolean options to default to None (#55951)
* Allow plugin boolean options to default to None * fix mistake * changelog * be more specific
This commit is contained in:
parent
89d767c046
commit
47b2cb748b
2 changed files with 6 additions and 4 deletions
2
changelogs/fragments/55951-config-bool-options.yml
Normal file
2
changelogs/fragments/55951-config-bool-options.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- Allow config options that are type boolean to default to None rather than only True or False.
|
|
@ -83,11 +83,11 @@ def ensure_type(value, value_type, origin=None):
|
||||||
if value_type:
|
if value_type:
|
||||||
value_type = value_type.lower()
|
value_type = value_type.lower()
|
||||||
|
|
||||||
if value_type in ('boolean', 'bool'):
|
if value is not None:
|
||||||
value = boolean(value, strict=False)
|
if value_type in ('boolean', 'bool'):
|
||||||
|
value = boolean(value, strict=False)
|
||||||
|
|
||||||
elif value is not None:
|
elif value_type in ('integer', 'int'):
|
||||||
if value_type in ('integer', 'int'):
|
|
||||||
value = int(value)
|
value = int(value)
|
||||||
|
|
||||||
elif value_type == 'float':
|
elif value_type == 'float':
|
||||||
|
|
Loading…
Reference in a new issue