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
345 stars 170 forks source link

Paloalto firewall upgrade fails with error in upgrade.py #572

Open ladmitesh opened 3 months ago

ladmitesh commented 3 months ago

Describe the bug

Below is the script I am using to upgrade from 9.1.16 to 11.1.3 code:


from panos.firewall import Firewall

fw = Firewall("", "Username of PA Firewall ", "<Password of PA Firewall") fw.software.upgrade_to_version("11.1.3")

Expected behavior

It should not present any error.

Current behavior

Below is the output and error I get after running this script:


(paupgrade) # python3 test-upgrade.py

current ver:9.1.16

target ver:11.1.3

next_minor_version:10.0.0

go to next minor

next_version:10.0.0

current ver:10.0.0

target ver:11.1.3

next_minor_version:10.1.0

not direct, intermediate minor being skipped: 10.0.0 to 11.1.3

direct not possible

next_version:10.1.0

current ver:10.1.0

target ver:11.1.3

next_minor_version:10.2.0

not direct, intermediate minor being skipped: 10.1.0 to 11.1.3

direct not possible

next_version:10.2.0

Traceback (most recent call last):

File "/home/paupgrade/test-upgrade.py", line 4, in

fw.software.upgrade_to_version("11.1.3")

File "/home/paupgrade/lib/python3.10/site-packages/panos/updater.py", line 400, in upgrade_to_version

result = self.upgrade_to_version(target_version, dryrun=dryrun)

File "/home/paupgrade/lib/python3.10/site-packages/panos/updater.py", line 400, in upgrade_to_version

result = self.upgrade_to_version(target_version, dryrun=dryrun)

File "/home/paupgrade/lib/python3.10/site-packages/panos/updater.py", line 398, in upgrade_to_version

self.download_install_reboot(next_version, sync=True)

File "/home/paupgrade/lib/python3.10/site-packages/panos/updater.py", line 228, in download_install_reboot

self.download_install(version, load_config, sync=True)

File "/home/paupgrade/lib/python3.10/site-packages/panos/updater.py", line 204, in download_install

self.download(target_version, sync=True)

File "/home/paupgrade/lib/python3.10/site-packages/panos/updater.py", line 97, in download

raise err.PanDeviceError(

panos.errors.PanDeviceError: Device attempt to download version 10.2.0-h3 failed: ['Successfully downloaded', 'Preloading into software manager', "The required '10.2.0' base image must be loaded before this image can be loaded. You do not have to install or run the base image, only download it. Once the base is loaded, re-download your target image.\n", 'Failed to load into software manager. Please retry.', 'Post processing failed. Please retry.']

(paupgrade) #

Possible solution

The updater.py script in python module “pan-os-python” try to download and install 10.2.0-h3 in place of 10.2.0.

Your Environment

python3.10 PA-VM-100 model