PaloAltoNetworks / PaloAltoNetworks/pan-os-python

update content package is not functional with version string

Open
#394 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
400
Forks
199
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ContentUpdater.install path in panos/updater.py and reproduce the failure using the test_update_content.py example. Review the request handling referenced in panos/base.py and compare version="8503-7125" with version="latest". Done means installing the specified content version completes without the invalid-keyword error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.