validate-modules: do not treat falsy non-`False` defaults as `None` (#79267)

* Do not treat falsy non-False defaults as None.

* Fix various instances of this in modules.

* Add changelog fragment.
pull/79274/head
Felix Fontein 2 years ago committed by GitHub
parent 6674c43edd
commit 6e379e5d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- "ansible-test validate-modules - no longer treat falsy non-``False`` values for defaults as ``None`` (https://github.com/ansible/ansible/pull/79267)."

@ -28,11 +28,11 @@ options:
Spaces around the operator are required. Spaces around the operator are required.
- You can also pass an absolute path for a binary which is provided by the package to install. - You can also pass an absolute path for a binary which is provided by the package to install.
See examples for more information. See examples for more information.
required: true
aliases: aliases:
- pkg - pkg
type: list type: list
elements: str elements: str
default: []
list: list:
description: description:
@ -55,6 +55,7 @@ options:
When specifying multiple repos, separate them with a ",". When specifying multiple repos, separate them with a ",".
type: list type: list
elements: str elements: str
default: []
disablerepo: disablerepo:
description: description:
@ -63,6 +64,7 @@ options:
When specifying multiple repos, separate them with a ",". When specifying multiple repos, separate them with a ",".
type: list type: list
elements: str elements: str
default: []
conf_file: conf_file:
description: description:
@ -108,6 +110,7 @@ options:
version_added: "2.7" version_added: "2.7"
type: list type: list
elements: str elements: str
default: []
skip_broken: skip_broken:
description: description:
- Skip all unavailable packages or packages with broken dependencies - Skip all unavailable packages or packages with broken dependencies
@ -151,12 +154,14 @@ options:
version_added: "2.7" version_added: "2.7"
type: list type: list
elements: str elements: str
default: []
disable_plugin: disable_plugin:
description: description:
- I(Plugin) name to disable for the install/update operation. - I(Plugin) name to disable for the install/update operation.
The disabled plugins will not persist beyond the transaction. The disabled plugins will not persist beyond the transaction.
version_added: "2.7" version_added: "2.7"
type: list type: list
default: []
elements: str elements: str
disable_excludes: disable_excludes:
description: description:

@ -27,7 +27,6 @@ options:
- Key from which to return values from the specified database, otherwise the - Key from which to return values from the specified database, otherwise the
full contents are returned. full contents are returned.
type: str type: str
default: ''
service: service:
description: description:
- Override all databases with the specified service - Override all databases with the specified service

@ -118,7 +118,6 @@ options:
- TCP flags specification. - TCP flags specification.
- C(tcp_flags) expects a dict with the two keys C(flags) and C(flags_set). - C(tcp_flags) expects a dict with the two keys C(flags) and C(flags_set).
type: dict type: dict
default: {}
version_added: "2.4" version_added: "2.4"
suboptions: suboptions:
flags: flags:
@ -233,6 +232,7 @@ options:
- It can only be used in conjunction with the protocols tcp, udp, udplite, dccp and sctp. - It can only be used in conjunction with the protocols tcp, udp, udplite, dccp and sctp.
type: list type: list
elements: str elements: str
default: []
version_added: "2.11" version_added: "2.11"
to_ports: to_ports:
description: description:

@ -67,6 +67,7 @@ options:
- If not set, matches are removed entirely. - If not set, matches are removed entirely.
- Backreferences can be used ambiguously like C(\1), or explicitly like C(\g<1>). - Backreferences can be used ambiguously like C(\1), or explicitly like C(\g<1>).
type: str type: str
default: ''
after: after:
description: description:
- If specified, only content after this match will be replaced/removed. - If specified, only content after this match will be replaced/removed.

@ -76,6 +76,7 @@ options:
- Additional arguments provided on the command line. - Additional arguments provided on the command line.
- While using remote hosts with systemd this setting will be ignored. - While using remote hosts with systemd this setting will be ignored.
type: str type: str
default: ''
aliases: [ args ] aliases: [ args ]
use: use:
description: description:

@ -92,7 +92,7 @@ options:
- Command-line options with multiple elements must use multiple lines in the array, one for each element. - Command-line options with multiple elements must use multiple lines in the array, one for each element.
type: list type: list
elements: str elements: str
default: "" default: []
version_added: "2.1" version_added: "2.1"
remote_src: remote_src:
description: description:

@ -135,6 +135,7 @@ options:
of C(2.3) supplying C(Content-Type) here will override the header of C(2.3) supplying C(Content-Type) here will override the header
generated by supplying C(json) or C(form-urlencoded) for I(body_format). generated by supplying C(json) or C(form-urlencoded) for I(body_format).
type: dict type: dict
default: {}
version_added: '2.1' version_added: '2.1'
validate_certs: validate_certs:
description: description:

@ -41,11 +41,13 @@ options:
aliases: [ pkg ] aliases: [ pkg ]
type: list type: list
elements: str elements: str
default: []
exclude: exclude:
description: description:
- Package name(s) to exclude when state=present, or latest - Package name(s) to exclude when state=present, or latest
type: list type: list
elements: str elements: str
default: []
version_added: "2.0" version_added: "2.0"
list: list:
description: description:
@ -72,6 +74,7 @@ options:
separated string separated string
type: list type: list
elements: str elements: str
default: []
version_added: "0.9" version_added: "0.9"
disablerepo: disablerepo:
description: description:
@ -82,6 +85,7 @@ options:
separated string separated string
type: list type: list
elements: str elements: str
default: []
version_added: "0.9" version_added: "0.9"
conf_file: conf_file:
description: description:
@ -171,6 +175,7 @@ options:
The enabled plugin will not persist beyond the transaction. The enabled plugin will not persist beyond the transaction.
type: list type: list
elements: str elements: str
default: []
version_added: "2.5" version_added: "2.5"
disable_plugin: disable_plugin:
description: description:
@ -178,6 +183,7 @@ options:
The disabled plugins will not persist beyond the transaction. The disabled plugins will not persist beyond the transaction.
type: list type: list
elements: str elements: str
default: []
version_added: "2.5" version_added: "2.5"
releasever: releasever:
description: description:

@ -79,7 +79,7 @@ from .module_args import AnsibleModuleImportError, AnsibleModuleNotInitialized,
from .schema import ansible_module_kwargs_schema, doc_schema, return_schema from .schema import ansible_module_kwargs_schema, doc_schema, return_schema
from .utils import CaptureStd, NoArgsAnsibleModule, compare_unordered_lists, is_empty, parse_yaml, parse_isodate from .utils import CaptureStd, NoArgsAnsibleModule, compare_unordered_lists, parse_yaml, parse_isodate
if PY3: if PY3:
@ -1789,7 +1789,7 @@ class ModuleValidator(Validator):
) )
arg_default = None arg_default = None
if 'default' in data and not is_empty(data['default']): if 'default' in data and data['default'] is not None:
try: try:
with CaptureStd(): with CaptureStd():
arg_default = _type_checker(data['default']) arg_default = _type_checker(data['default'])
@ -1830,7 +1830,7 @@ class ModuleValidator(Validator):
try: try:
doc_default = None doc_default = None
if 'default' in doc_options_arg and not is_empty(doc_options_arg['default']): if 'default' in doc_options_arg and doc_options_arg['default'] is not None:
with CaptureStd(): with CaptureStd():
doc_default = _type_checker(doc_options_arg['default']) doc_default = _type_checker(doc_options_arg['default'])
except (Exception, SystemExit): except (Exception, SystemExit):

@ -30,7 +30,6 @@ lib/ansible/modules/copy.py pylint:disallowed-name
lib/ansible/modules/copy.py validate-modules:doc-default-does-not-match-spec lib/ansible/modules/copy.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/copy.py validate-modules:nonexistent-parameter-documented lib/ansible/modules/copy.py validate-modules:nonexistent-parameter-documented
lib/ansible/modules/copy.py validate-modules:undocumented-parameter lib/ansible/modules/copy.py validate-modules:undocumented-parameter
lib/ansible/modules/dnf.py validate-modules:doc-required-mismatch
lib/ansible/modules/dnf.py validate-modules:parameter-invalid lib/ansible/modules/dnf.py validate-modules:parameter-invalid
lib/ansible/modules/file.py validate-modules:undocumented-parameter lib/ansible/modules/file.py validate-modules:undocumented-parameter
lib/ansible/modules/find.py use-argspec-type-path # fix needed lib/ansible/modules/find.py use-argspec-type-path # fix needed

Loading…
Cancel
Save