From becedb9efe0cf007c6397e41f6c76afaf6ccd8f6 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Wed, 10 Mar 2021 10:20:28 -0500 Subject: [PATCH] Replace _CHECK_ARGUMENT_TYPES_DISPATCHER with get_type_validator --- changelogs/fragments/replace-private-attr.yaml | 3 +++ plugins/module_utils/network/common/utils.py | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/replace-private-attr.yaml diff --git a/changelogs/fragments/replace-private-attr.yaml b/changelogs/fragments/replace-private-attr.yaml new file mode 100644 index 000000000..43edbb5f4 --- /dev/null +++ b/changelogs/fragments/replace-private-attr.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Replace uses of internal attribute _CHECK_ARGUMENT_TYPES_DISPATCHER with the public interface get_type_validator diff --git a/plugins/module_utils/network/common/utils.py b/plugins/module_utils/network/common/utils.py index ea41dcd6b..6d309f56f 100644 --- a/plugins/module_utils/network/common/utils.py +++ b/plugins/module_utils/network/common/utils.py @@ -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 @@ -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]