PaloAltoNetworks / PaloAltoNetworks/pan-os-python

Syncreboot on firewall fails via Panorama

Open
#249 1 comment 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

Did a upgrade_to_version() on a Firewall via Panorama and got an exception when it waited for reboot.

Expected behavior

Syncreboot should poll device information untill reboot successfully or timeout reached.

Current behavior

After some time an exception is raised from base.py

File "/.local/lib/python3.8/site-packages/panos/base.py", line 4748, in syncreboot
raise e
File "/.local/lib/python3.8/site-packages/panos/base.py", line 4739, in syncreboot
version = self.refresh_version()
File "/.local/lib/python3.8/site-packages/panos/base.py", line 3986, in refresh_version
system_info = self.refresh_system_info()
File "/.local/lib/python3.8/site-packages/panos/base.py", line 3938, in refresh_system_info
system_info = self.show_system_info()
File "/.local/lib/python3.8/site-packages/panos/base.py", line 3895, in show_system_info
root = self.xapi.op(cmd="show system info", cmd_xml=True)
File "/.local/lib/python3.8/site-packages/panos/base.py", line 3647, in method
raise the_exception
panos.errors.PanDeviceXapiError: serialnr not connected

Possible solution

Not a great solution but what I did for a quick fix was add check error if not str(e).endswith("not connected") as this is a connection error thrown by panorama(?)

Steps to reproduce

i.e:
fw = Firewall(serial=<serialnr>)
panorama = Panorama(ip, usn, pw)
panorama.add(fw)
fw.restart()
fw.syncreboot()
`
Can also start a upgrade_to_version and wait for reboot.

Context

Automatically setup and update many hardware model PA-220

Your Environment

Hardware model PA-220
Python 3.8
pan-os-python==1.0.0b2

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 in base.py at syncreboot and follow its refresh_version, refresh_system_info, and show_system_info calls. Reproduce the Firewall-through-Panorama reboot or upgrade flow and examine how the “not connected” PanDeviceXapiError is handled. Done means syncreboot continues polling until the device returns successfully or the timeout is reached.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.