Skip to content

Executing RPC with filters returns The error was: AttributeError: 'JuniperJunosModule' object has no attribute '_check_type_dict' #620

@mamathac

Description

@mamathac

juniper.device collection and Python libraries version


root@masterhost:~# ansible-galaxy collection list

# /usr/local/lib/python3.8/dist-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    2.1.0
ansible.netcommon             2.5.1
ansible.posix                 1.3.0
ansible.utils                 2.5.0
ansible.windows               1.9.0
arista.eos                    3.1.0
awx.awx                       19.4.0
azure.azcollection            1.11.0
check_point.mgmt              2.2.2
chocolatey.chocolatey         1.2.0
cisco.aci                     2.1.0
cisco.asa                     2.1.0
cisco.intersight              1.0.18
cisco.ios                     2.7.1
cisco.iosxr                   2.7.0
cisco.ise                     1.2.1
cisco.meraki                  2.6.0
cisco.mso                     1.3.0
cisco.nso                     1.0.3
cisco.nxos                    2.9.0
cisco.ucs                     1.6.0
cloud.common                  2.1.0
cloudscale_ch.cloud           2.2.0
community.aws                 2.3.0
community.azure               1.1.0
community.ciscosmb            1.0.4
community.crypto              2.2.2
community.digitalocean        1.15.1
community.dns                 2.0.7
community.docker              2.2.0
community.fortios             1.0.0
community.general             4.5.0
community.google              1.0.0
community.grafana             1.3.2
community.hashi_vault         2.3.0
community.hrobot              1.2.2
community.kubernetes          2.0.1
community.kubevirt            1.0.0
community.libvirt             1.0.2
community.mongodb             1.3.2
community.mysql               2.3.4
community.network             3.0.0
community.okd                 2.1.0
community.postgresql          1.7.0
community.proxysql            1.3.1
community.rabbitmq            1.1.0
community.routeros            2.0.0
community.skydive             1.0.0
community.sops                1.2.0
community.vmware              1.17.1
community.windows             1.9.0
community.zabbix              1.5.1
containers.podman             1.9.1
cyberark.conjur               1.1.0
cyberark.pas                  1.0.13
dellemc.enterprise_sonic      1.1.0
dellemc.openmanage            4.4.0
dellemc.os10                  1.1.1
dellemc.os6                   1.0.7
dellemc.os9                   1.0.4
f5networks.f5_modules         1.14.0
fortinet.fortimanager         2.1.4
fortinet.fortios              2.1.4
frr.frr                       1.0.3
gluster.gluster               1.0.2
google.cloud                  1.0.2
hetzner.hcloud                1.6.0
hpe.nimble                    1.1.4
ibm.qradar                    1.0.3
infinidat.infinibox           1.3.3
infoblox.nios_modules         1.2.1
inspur.sm                     1.3.0
junipernetworks.junos         2.9.0
kubernetes.core               2.2.3
mellanox.onyx                 1.0.0
netapp.aws                    21.7.0
netapp.azure                  21.10.0
netapp.cloudmanager           21.14.0
netapp.elementsw              21.7.0
netapp.ontap                  21.16.0
netapp.storagegrid            21.9.0
netapp.um_info                21.8.0
netapp_eseries.santricity     1.2.13
netbox.netbox                 3.5.1
ngine_io.cloudstack           2.2.3
ngine_io.exoscale             1.0.0
ngine_io.vultr                1.1.0
openstack.cloud               1.7.0
openvswitch.openvswitch       2.1.0
ovirt.ovirt                   1.6.6
purestorage.flasharray        1.12.1
purestorage.flashblade        1.9.0
sensu.sensu_go                1.13.0
servicenow.servicenow         1.0.6
splunk.es                     1.0.2
t_systems_mms.icinga_director 1.27.1
theforeman.foreman            2.2.0
vyos.vyos                     2.7.0
wti.remote                    1.0.3

# /root/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 5.1.1
ansible.utils     2.10.3
juniper.device    1.0.1

root@masterhost:~# ansible --version
ansible [core 2.12.3]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 3.1.2
  libyaml = True

OS / Environment

NA

Summary

On running a playbook to filter an RPC with args , error occurs.

Steps to reproduce

Run the ansible playbook shown

---
- name: Testing Collections Persistent
  hosts: [SINGLE]
  connection: juniper.device.pyez
  gather_facts: no
  collections:
    - juniper.device
  
  tasks:
    - name: "Execute RPC with filters"
      rpc:
        rpcs:
           - "get-config"
        format: xml
        filter: <configuration><groups><name>re0</name></groups></configuration>
        attr: name=re0
      register: test1
      ignore_errors: True
      tags: rpc_a

Expected results

TASK [Execute RPC with filters] *****************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'JuniperJunosModule' object has no attribute '_check_type_dict'
fatal: [10.204.39.63]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-local-10778e55bheik/ansible-tmp-1686303814.916357-10983-36112855681718/AnsiballZ_rpc.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-local-10778e55bheik/ansible-tmp-1686303814.916357-10983-36112855681718/AnsiballZ_rpc.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-local-10778e55bheik/ansible-tmp-1686303814.916357-10983-36112855681718/AnsiballZ_rpc.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.rpc', init_globals=dict(_module_fqn='ansible_collections.juniper.device.plugins.modules.rpc', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_rpc_payload_ubfvx0d3/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/modules/rpc.py\", line 631, in <module>\n  File \"/tmp/ansible_rpc_payload_ubfvx0d3/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/modules/rpc.py\", line 468, in main\n  File \"/tmp/ansible_rpc_payload_ubfvx0d3/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py\", line 935, in parse_arg_to_list_of_dicts\nAttributeError: 'JuniperJunosModule' object has no attribute '_check_type_dict'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
...ignoring

Actual results

root@masterhost:/etc/ansible# ansible-playbook /etc/ansible/ansible_collections_persistent_playbook.yaml -t p5 -vvv
ansible-playbook [core 2.12.3]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 3.1.2
  libyaml = True
No config file found; using defaults
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: ansible_collections_persistent_playbook.yaml ****************************************************************************************
1 plays in /etc/ansible/ansible_collections_persistent_playbook.yaml
[WARNING]: Found variable using reserved name: timeout

PLAY [Testing Collections Persistent] *********************************************************************************************************
META: ran handlers

TASK [Execute RPC with filters] ***************************************************************************************************************
task path: /etc/ansible/ansible_collections_persistent_playbook.yaml:52
<10.204.39.63> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.204.39.63> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-13069w8srdifn `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702 `" && echo ansible-tmp-1686309288.536057-13074-219301847114702="` echo /root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/juniper/device/plugins/modules/rpc.py
<10.204.39.63> PUT /root/.ansible/tmp/ansible-local-13069w8srdifn/tmpkxif6svr TO /root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py
<10.204.39.63> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/ /root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py && sleep 0'
<10.204.39.63> EXEC /bin/sh -c '/usr/bin/python3.8 /root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py && sleep 0'
<10.204.39.63> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py", line 107, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.rpc', init_globals=dict(_module_fqn='ansible_collections.juniper.device.plugins.modules.rpc', _modlib_path=modlib_path),
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_rpc_payload_3vvlvep2/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/modules/rpc.py", line 631, in <module>
  File "/tmp/ansible_rpc_payload_3vvlvep2/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/modules/rpc.py", line 468, in main
  File "/tmp/ansible_rpc_payload_3vvlvep2/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py", line 935, in parse_arg_to_list_of_dicts
AttributeError: 'JuniperJunosModule' object has no attribute '_check_type_dict'
fatal: [10.204.39.63]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-local-13069w8srdifn/ansible-tmp-1686309288.536057-13074-219301847114702/AnsiballZ_rpc.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.rpc', init_globals=dict(_module_fqn='ansible_collections.juniper.device.plugins.modules.rpc', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_rpc_payload_3vvlvep2/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/modules/rpc.py\", line 631, in <module>\n  File \"/tmp/ansible_rpc_payload_3vvlvep2/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/modules/rpc.py\", line 468, in main\n  File \"/tmp/ansible_rpc_payload_3vvlvep2/ansible_rpc_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py\", line 935, in parse_arg_to_list_of_dicts\nAttributeError: 'JuniperJunosModule' object has no attribute '_check_type_dict'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
...ignoring
META: ran handlers
META: ran handlers

PLAY RECAP ************************************************************************************************************************************
10.204.39.63               : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=1


Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions