PaloAltoNetworks / pan-os-python

The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.
https://pan-os-python.readthedocs.io
ISC License
341 stars 169 forks source link

update content package is not functional with version string #394

Open kevinhuy opened 2 years ago

kevinhuy commented 2 years ago

Describe the bug

when trying to install a specific version in content update it failed.

fw = firewall.Firewall(hostname="", username="")    
updater.ContentUpdater(fw).check()
updater.ContentUpdater(fw).download()
updater.ContentUpdater(fw).install(version="8503-7125", sync=True)

Expected behavior

execute without error

Current behavior

Traceback (most recent call last): File "test_update_content.py", line 41, in main() File "test_update_content.py", line 37, in main install_content = updater.ContentUpdater(fw).install(version="8503-7125", sync=True) File "/home/kevin/.pyenv/versions/panos/lib/python3.8/site-packages/panos/updater.py", line 544, in install response = self._op(op) File "/home/kevin/.pyenv/versions/panos/lib/python3.8/site-packages/panos/updater.py", line 38, in _op return self.pandevice.xapi.op(cmd, cmd_xml=True) File "/home/kevin/.pyenv/versions/panos/lib/python3.8/site-packages/panos/base.py", line 3682, in method raise the_exception panos.errors.PanDeviceXapiError: request -> content -> upgrade -> install -> version '8503-7125' is not an allowed keyword request -> content -> upgrade -> install -> version is invalid

Possible solution

with keyword latest it work without issue. updater.ContentUpdater(fw).install(version="latest", sync=True)

welcome-to-palo-alto-networks[bot] commented 2 years ago

:tada: Thanks for opening your first issue here! Welcome to the community!

shinmog commented 2 years ago

Is "9503-7125" downloaded before you try to invoke .install(version="9503-7125")?

kevinhuy commented 2 years ago

Hi

Yes was already downloaded before the try.

Thks