ansible-collections / junipernetworks.junos

Ansible Network Collection for Juniper JunOS
GNU General Public License v3.0
84 stars 63 forks source link

Gathering hardware facts fails with 4.1.0 #349

Open mweinelt opened 1 year ago

mweinelt commented 1 year ago
SUMMARY

Gathering hardware facts fails with 4.1.0, is fine with 4.0.0.

ISSUE TYPE
COMPONENT NAME

junipernetworks.junos.junos

ANSIBLE VERSION
ansible [core 2.14.0]
  config file = /home/hexa/git/man-da/ansible-network/ansible.cfg
  configured module search path = ['/home/hexa/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/hexa/git/man-da/ansible-network/.venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/hexa/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/hexa/git/man-da/ansible-network/.venv/bin/ansible
  python version = 3.10.8 (main, Oct 11 2022, 11:35:05) [GCC 11.3.0] (/home/hexa/git/man-da/ansible-network/.venv/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
Collection            Version
--------------------- -------
junipernetworks.junos 4.1.0  
CONFIGURATION
CALLBACKS_ENABLED(/home/hexa/git/man-da/ansible-network/ansible.cfg) = ['ansible.posix.profile_tasks']
CONFIG_FILE() = /home/hexa/git/man-da/ansible-network/ansible.cfg
DEFAULT_FORKS(/home/hexa/git/man-da/ansible-network/ansible.cfg) = 12
DEFAULT_HOST_LIST(/home/hexa/git/man-da/ansible-network/ansible.cfg) = ['/home/hexa/git/man-da/ansible-network/inventory']
DEFAULT_STDOUT_CALLBACK(/home/hexa/git/man-da/ansible-network/ansible.cfg) = community.general.yaml
DIFF_ALWAYS(/home/hexa/git/man-da/ansible-network/ansible.cfg) = True
HOST_KEY_CHECKING(/home/hexa/git/man-da/ansible-network/ansible.cfg) = False
NETCONF_SSH_CONFIG(/home/hexa/git/man-da/ansible-network/ansible.cfg) = ~/.ssh/config
PERSISTENT_COMMAND_TIMEOUT(/home/hexa/git/man-da/ansible-network/ansible.cfg) = 600
OS / ENVIRONMENT

Linux Python 3.10.8

STEPS TO REPRODUCE

- name: Depoly the system configuration section to JunOS devices
  hosts: junos_all
  gather_facts: false
  pre_tasks:
    - name: "Get JunOS facts"
      junipernetworks.junos.junos_facts:
        gather_subset:
          - hardware
          - default
        config_format: json
      register: facts
      throttle: "1"
EXPECTED RESULTS

Gather hardware facts.

ACTUAL RESULTS
TASK [Get JunOS facts] ***************************************************************************************************************************************************************
task path: /home/hexa/git/man-da/ansible-network/junos_system.yml:7
Thursday 01 December 2022  18:31:08 +0100 (0:00:00.030)       0:00:00.030 ***** 
redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf
redirecting (type: netconf) ansible.builtin.junos to junipernetworks.junos.junos
redirecting (type: action) junipernetworks.junos.junos_facts to junipernetworks.junos.junos
redirecting (type: action) junipernetworks.junos.junos_facts to junipernetworks.junos.junos
fatal: [example.com]: FAILED! => changed=false 
  module_stderr: '''Hardware'' object has no attribute ''_module'''
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
rohitthakur2590 commented 1 year ago

@mweinelt This is not reproducible for me wiht vsrx18.4R1, could you please provide detailed debug logs for the failure mentioned above.You can enable detailed debug logs with

export ANSIBLE_LOG_PATH=ansible.log
export ANSIBLE_PERSISTENT_LOG_MESSAGES=TRUE
export ANSIBLE_DEBUG=TRUE
mweinelt commented 1 year ago

This example runs against an EX2200-C running JUNOS 12.3R12, but can also reproduce on an ACX5448 running 20.2.R3

https://gist.github.com/mweinelt/485ed63892fb99c5ef8b70a36ae0a7b7

TkPegatron commented 1 year ago

I am reproducing the same issue against EX-3400/4300's running JUNOS 22.2R1.9 and 14.1X53-D46.7.

Task:

    # For debugging purposes
    - name: Juniper | Collect Facts and Configuration
      run_once: true
      junipernetworks.junos.junos_facts:
        gather_subset: hardware

ansible.log: https://gist.github.com/TkPegatron/7860e9dee01e93b2800122f4c91874cb

toreanderson commented 1 year ago

Same for EX4200-48T and EX2200-48T-4G running JunOS 12.3 and 15.1. gather_subset all and hardware fails, while config, interfaces and min works.

mweinelt commented 10 months ago

I can still reproduce this issue on 6.0.0.

EX3400 with 21.4R3-S3.4

Edit: Works after installing xmltodict, so I assume it broke in 8dc32637e61e445a6820fab7b3e668fd7e9884db.

GD1200 commented 3 months ago

The problem is also reproducible on 8.0.0 when fetching "hardware" data from mx10008 running 22.4R2.8. It was also solved for me by installing xmltodict module.

ryeleo commented 1 month ago

The problem is also reproducible on 9.1.0 when fetching "hardware" data. It was also solved for me by installing xmltodict Python module.