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

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

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

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

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

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

@ -135,6 +135,7 @@ options:
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).
type: dict
default: {}
version_added: '2.1'
validate_certs:
description:

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

@ -79,7 +79,7 @@ from .module_args import AnsibleModuleImportError, AnsibleModuleNotInitialized,
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:
@ -1789,7 +1789,7 @@ class ModuleValidator(Validator):
)
arg_default = None
if 'default' in data and not is_empty(data['default']):
if 'default' in data and data['default'] is not None:
try:
with CaptureStd():
arg_default = _type_checker(data['default'])
@ -1830,7 +1830,7 @@ class ModuleValidator(Validator):
try:
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():
doc_default = _type_checker(doc_options_arg['default'])
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:nonexistent-parameter-documented
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/file.py validate-modules:undocumented-parameter
lib/ansible/modules/find.py use-argspec-type-path # fix needed

Loading…
Cancel
Save