Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "AttributeError: 'NoneType' object has no attribute 'group'" when installing software on switches with multiple RE #1099

Closed
wilamike opened this issue Mar 24, 2021 · 0 comments

Comments

@wilamike
Copy link
Contributor

Return error when calling pyEZ using Ansible module juniper.device.juniper_junos_software. It only happens for Juniper EX switch with more than 1 RE. The test unit is a Juniper EX4300 with 2 REs on OS 18.2R1.9.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'group'
fatal: [junipersw]: FAILED! => changed=false
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/mikng/.ansible/tmp/ansible-local-28385bnn35ozf/ansible-tmp-1616549333.4061427-28471-77421281602831/AnsiballZ_juniper_junos_software.py", line 102, in <module>
        _ansiballz_main()
      File "/home/mikng/.ansible/tmp/ansible-local-28385bnn35ozf/ansible-tmp-1616549333.4061427-28471-77421281602831/AnsiballZ_juniper_junos_software.py", line 94, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/mikng/.ansible/tmp/ansible-local-28385bnn35ozf/ansible-tmp-1616549333.4061427-28471-77421281602831/AnsiballZ_juniper_junos_software.py", line 40, in invoke_module
        runpy.run_module(mod_name='ansible_collections.juniper.device.plugins.modules.juniper_junos_software', init_globals=None, run_name='__main__', alter_sys=True)
      File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
        mod_name, mod_spec, pkg_name, script_name)
      File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_juniper.device.juniper_junos_software_payload_l35mb0t6/ansible_juniper.device.juniper_junos_software_payload.zip/ansible_collections/juniper/device/plugins/modules/juniper_junos_software.py", line 775, in <module>
      File "/tmp/ansible_juniper.device.juniper_junos_software_payload_l35mb0t6/ansible_juniper.device.juniper_junos_software_payload.zip/ansible_collections/juniper/device/plugins/modules/juniper_junos_software.py", line 687, in main
      File "/home/mikng/.gen-amer-eng-venv/lib64/python3.6/site-packages/jnpr/junos/utils/sw.py", line 984, in install
        vc_members = [re.search("(\d+)", x).group(1) for x in self._RE_list]
      File "/home/mikng/.gen-amer-eng-venv/lib64/python3.6/site-packages/jnpr/junos/utils/sw.py", line 984, in <listcomp>
        vc_members = [re.search("(\d+)", x).group(1) for x in self._RE_list]
    AttributeError: 'NoneType' object has no attribute 'group'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

After further troubleshoot, the list value in self._RE_list returned by the juniper device are:

localre
fpc0
fpc1

Will open a PR to fix the line 984 of jnpr/junos/utils/sw.py to skip any value without digit in it.

wilamike added a commit to wilamike/py-junos-eznc that referenced this issue Apr 2, 2021
rahkumar651991 added a commit that referenced this issue May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants