Crash when calling refresh_devices(expand_vsys=False)
Describe the bug
After establishing an initial connection to Panorama, calling the refresh_devices() function with expand_vsys set to False throws an AttributeError exception.
Expected behavior
The devices should be returned from Panorama.
Current behavior
An Exception is thrown.
Possible solution
Unsure at this point. Will update later if I'm able to find one.
Current workaround is to leave it as its default value of True: expand_vsys=True
Steps to reproduce
- Run this code snippet, substituting in the correct hostname, username, and password:
from panos.panorama import Panorama
pano = Panorama(hostname="foo", api_username="admin", api_password="admin")
pano.refresh_devices(expand_vsys=False)
Screenshots
Hostname, credentials, and device group names changed to example values.
>>> from panos.panorama import Panorama
>>> pano = Panorama(hostname="foo", api_username="admin", api_password="admin")
>>> pano.refresh_devices(expand_vsys=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/matt/Library/Caches/pypoetry/virtualenvs/nautobot-plugin-chatops-panorama-B7XIf4lc-py3.9/lib/python3.9/site-packages/panos/panorama.py", line 640, in refresh_devices
firewall_instances = tmp_fw.refreshall_from_xml(
File "/Users/matt/Library/Caches/pypoetry/virtualenvs/nautobot-plugin-chatops-panorama-B7XIf4lc-py3.9/lib/python3.9/site-packages/panos/firewall.py", line 378, in refreshall_from_xml
fw._set_version_and_version_info(entry.findtext("sw-version"))
File "/Users/matt/Library/Caches/pypoetry/virtualenvs/nautobot-plugin-chatops-panorama-B7XIf4lc-py3.9/lib/python3.9/site-packages/panos/base.py", line 4027, in _set_version_and_version_info
tokens = self.version.split(".")[:3]
AttributeError: 'NoneType' object has no attribute 'split'
>>> pano.refresh_devices()
[<DeviceGroup Foobar1 0x105cab230>, <DeviceGroup Foobar2 0x105cabee3>]
>>>
Context
I am trying to pull a list of Palo Alto firewall devices, but am unable to use this optional argument.
Your Environment
- Version used: 1.4.0
- Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): Python 3.9.6, Panorama 10.1.0
- Operating System and version (desktop or mobile): OSX 11.4
- Link to your project: n/a (internal project)
:tada: Thanks for opening your first issue here! Welcome to the community!
I am having the same problem: from panos import panorama PANO = panorama.Panorama(IP, api_key=API_KEY) DEVICELIST = PANO.refresh_devices(include_device_groups=False)
Traceback (most recent call last):
File "/Users/x/PycharmProjects/pythonProject/main.py", line 46, in