Skip to content

Use of private attribute module._CHECK_ARGUMENT_TYPES_DISPATCHER #186

@samdoran

Description

@samdoran
SUMMARY

As part of the role argument spec validation work for Ansible 2.11 (ansible/ansible#72667), the private attribute AnsibleModule._CHECK_ARGUMENT_TYPES_DISPATCHER moved to to lib/ansible/module_utils/common/parameters.py. Any code using that private attribute should instead use DEFAULT_TYPE_VALIDATORS or preferably get_validator() from the new location.

I left in AnsibleModule._CHECK_ARGUMENT_TYPES_DISPATCHER for backwards compatibility.

I mainly just wanted to give you a heads up that things are moving, though I did my best to make sure nothing would break.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible/netcommon/plugins/module_utils/network/common/utils.py

ANSIBLE VERSION
ansible 2.11.0.dev0 (arg_spec/get_wanted_type 5ca601bfca) last updated 2020/12/17 15:18:08 (GMT -400)
  config file = /Users/sdoran/.ansible.cfg
  configured module search path = ['/usr/local/share/ansible/library']
  ansible python module location = /Users/sdoran/Source/ansible/lib/ansible
  ansible collection location = /Users/sdoran/.ansible/collections:/usr/local/share/ansible/collections
  executable location = /Users/sdoran/Source/ansible/bin/ansible
  python version = 3.9.0 (default, Oct 14 2020, 11:40:34) [Clang 12.0.0 (clang-1200.0.32.2)]
  jinja version = 2.11.2
  libyaml = True
CONFIGURATION
> ansible-config dump --only-changed
DEFAULT_LOG_PATH(env: ANSIBLE_LOG_PATH) = /Users/sdoran/.ansible/ansible.log
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /Users/sdoran/bin/getvaultkey.sh
DEVEL_WARNING(env: ANSIBLE_DEVEL_WARNING) = False
OS / ENVIRONMENT
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H114
STEPS TO REPRODUCE

Search for uses of ._CHECK_ARGUMENT_TYPES_DISPATCHER

EXPECTED RESULTS

No uses found.

ACTUAL RESULTS

Several instances found.

> ag \._CHECK_ARGUMENT_TYPES_DISPATCHER
cisco/nxos/plugins/modules/nxos_user.py
333:        type_checker = module._CHECK_ARGUMENT_TYPES_DISPATCHER[value_type]

cisco/ios/plugins/modules/ios_vrf.py
586:        type_checker = module._CHECK_ARGUMENT_TYPES_DISPATCHER[value_type]

cisco/ios/plugins/modules/ios_user.py
486:        type_checker = module._CHECK_ARGUMENT_TYPES_DISPATCHER[value_type]

ansible/netcommon/plugins/module_utils/network/common/utils.py
291:                type_checker = self._module._CHECK_ARGUMENT_TYPES_DISPATCHER[

junipernetworks/junos/plugins/modules/junos_user.py
251:        type_checker = module._CHECK_ARGUMENT_TYPES_DISPATCHER[value_type]

Metadata

Metadata

Assignees

No one assigned

    Labels

    has_prThis issue has an associated PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions