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

Replace _CHECK_ARGUMENT_TYPES_DISPATCHER #234

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/replace-private-attr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
trivial:
- Replace uses of internal attribute _CHECK_ARGUMENT_TYPES_DISPATCHER with the public interface get_type_validator
5 changes: 2 additions & 3 deletions plugins/module_utils/network/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

from ansible.module_utils._text import to_text, to_bytes
from ansible.module_utils.common._collections_compat import Mapping
from ansible.module_utils.common.parameters import get_type_validator
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils import basic
from ansible.module_utils.parsing.convert_bool import boolean
Expand Down Expand Up @@ -288,9 +289,7 @@ def __call__(self, value, strict=True):

if value[name] is not None:
value_type = attr.get("type", "str")
type_checker = self._module._CHECK_ARGUMENT_TYPES_DISPATCHER[
value_type
]
type_checker, unused = get_type_validator(value_type)
type_checker(value[name])
elif value.get(name):
value[name] = self._module.params[name]
Expand Down