ansible-network / network-engine

This role provides the foundation for building network roles by providing modules and plugins that are common to all Ansible Network roles.
GNU General Public License v3.0
112 stars 52 forks source link

command_parser missing file is not displayed in error MSG #234

Open epicanthal opened 5 years ago

epicanthal commented 5 years ago

ISSUE TYPE

ANSIBLE VERSION

ansible --version
ansible 2.7.8
  config file = /var/lib/awx/projects/net_compliance/ansible.cfg
  configured module search path = [u'/var/lib/awx/projects/net_compliance/library', u'/usr/lib/python2.7/site-packages/napalm_ansible/modules', u'/usr/lib/python2.7/site-packages/ntc-ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

ansible-galaxy list | grep ansible.network
- ansible-network.config_store, (unknown version)
- ansible-network.network-engine, v2.7.5
- ansible-network.cisco_ios, v2.7.1

Network OS

Docker Container (awx_task):

[root@4567e492e296 net_compliance]# uname -a
Linux 4567e492e296 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

SUMMARY

network-engine 2.7.5, the error message received when the command_parser template is "missing or invalid" no longer provides the file path/name within the message, rather only "None" is provided. As seen below, the filename and path are provided when going back to network-engine 2.7.3

STEPS TO REPRODUCE

Use command_parser with any filename that doesn't actually exist (or not in the path):

    - name: PARSE THE RAW OUTPUT
      command_parser:
        file: "{{ parser_template_dir }}/ios/show_run_interface_switch1.yaml"
        content: "{{ ansible_net_config }}"

EXPECTED RESULTS

Output similar to ansible-network.network-engine v2.7.3

fatal: [switch_hostname]: FAILED! => {}

MSG:

src [/var/lib/awx/projects/net_compliance/parser_templates/ios/show_run_interface_switch1.yaml] is either missing or invalid

ACTUAL RESULTS

Paste verbatim command output between quotes below -->

ansible-network.network-engine v2.7.5

fatal: [switch_hostname]: FAILED! => {}

MSG:

src [None] is either missing or invalid
trishnaguha commented 5 years ago

resolved_by_pr https://github.com/ansible-network/network-engine/pull/240