Module: updater¶
Inheritance diagram¶
Class Reference¶
Device updater handles software versions and updates for devices
-
class
panos.updater.
ContentUpdater
(pandevice)[source]¶ -
check
()[source]¶ Trigger PAN-OS to get versions, then synchronize this object instance.
First, PAN-OS will reach out to the upgrade servers to get the list of all version that can be upgraded to. Then synchronizes this current updater state with the live device.
-
downgrade
(sync=False)[source]¶ Return to the previous content version.
Parameters: sync (bool, optional) – Run jobs synchronously and return the result. Defaults to False. Returns: If sync, returns result of install job
-
download
(sync_to_peer=None, sync=False)[source]¶ Download the latest content version.
Parameters: - sync_to_peer (bool, optional) – Send a copy to HA peer. Defaults to None.
- sync (bool, optional) – Run jobs synchronously and return the result. Defaults to False.
Raises: err.PanDeviceError
– on unsuccessful downloadReturns: If sync, returns result of download job
-
download_install
(version='latest', sync_to_peer=False, skip_commit=False, sync=False)[source]¶ Download and install the requested content version.
Like a combinations of the
check()
,download()
, andinstall()
methods.Parameters: - version (string) – Content version (eg. “8357-6464”). Defaults to “latest”.
- sync_to_peer (bool, optional) – Send a copy to HA peer. Defaults to False.
- skip_commit (bool, optional) – Do not perform a commit after install. Defaults to False.
- sync (bool, optional) – Run jobs synchronously and return the result. Defaults to False.
-
info
()[source]¶ Fetch version list from live device.
Synchronizes this current updater state with the live device.
-
install
(version='latest', sync_to_peer=True, skip_commit=False, sync=False)[source]¶ Install the requested content version.
Parameters: - version (string) – Content version (eg. “8357-6464”). Defaults to “latest”.
- sync_to_peer (bool, optional) – Send a copy to HA peer. Defaults to True.
- skip_commit (bool, optional) – Do not perform a commit after install. Defaults to False.
- sync (bool, optional) – Run jobs synchronously and return the result. Defaults to False.
Raises: err.PanDeviceError
– on unsuccessful installReturns: If sync, returns result of install job
-
-
class
panos.updater.
SoftwareUpdater
(pandevice)[source]¶ -
check
()[source]¶ Trigger PAN-OS to get versions, then synchronize this object instance.
First, PAN-OS will reach out to the upgrade servers to get the list of all version that can be upgraded to. Then synchronizes this current updater state with the live device.
-
download
(version, sync_to_peer=True, sync=False)[source]¶ PAN-OS downloads the requested version.
Parameters: - version (string) – PAN-OS version (eg. “10.0.2”)
- sync_to_peer (bool, optional) – Send a copy to HA peer. Defaults to True.
- sync (bool, optional) – Run job synchronously and return the result. Defaults to False.
Raises: err.PanDeviceError
– on unsuccessful downloadReturns: If sync, returns result of PAN-OS download job
-
download_install
(version, load_config=None, sync=False)[source]¶ Download and install the requested PAN-OS version.
Like a combinations of the
check()
,download()
, andinstall()
methods, but with some additional checks. For example, it will not act if the requested version is already running, and it will skip to the install if it is already downloaded.Does not perform the required reboot after the install.
Parameters: - version (string) – PAN-OS version (eg. “10.0.2”)
- load_config (string, optional) – Configuration to use for booting new software. Defaults to None.
- sync (bool, optional) – Run jobs synchronously and return the result. Defaults to False.
Raises: err.PanDeviceError
– problem found in pre-download checksReturns: If sync, returns result of PAN-OS install job
-
download_install_reboot
(version, load_config=None, sync=False)[source]¶ Download and install the requested PAN-OS version, then reboot.
Like a combinations of the
check()
,download()
, andinstall()
methods with a reboot at the end. It has additional checks. For example, it will not act if the requested version is already running, and it will skip to the install if it is already downloaded.Parameters: - version (string) – PAN-OS version (eg. “10.0.2”)
- load_config (string, optional) – Configuration to use for booting new software. Defaults to None.
- sync (bool, optional) – Run jobs synchronously and return the result. Defaults to False.
Raises: err.PanDeviceError
– problem found in pre-download checks or after reboot
-
info
()[source]¶ Fetch version list from live device.
Synchronizes this current updater state with the live device.
-
install
(version, load_config=None, sync=False)[source]¶ Install the requested PAN-OS version.
Does not download the software or perform the reboot required after installation.
Parameters: - version (string) – PAN-OS version (eg. “10.0.2”)
- load_config (string, optional) – Configuration to use for booting new software. Defaults to None.
- sync (bool, optional) – Run job synchronously and return the result. Defaults to False.
Raises: err.PanDeviceError
– on unsuccessful installReturns: If sync, returns result of PAN-OS install job
-
upgrade_to_version
(target_version, dryrun=False)[source]¶ Upgrade to the target version, completing all intermediate upgrades.
For example, if firewall is running version 9.0.5 and target version is 10.0.2, then this method will proceed through the following steps:
- Upgrade to 9.1.0 and reboot
- Upgrade to 10.0.0 and reboot
- Upgrade to 10.0.2 and reboot
Does not account for HA pairs.
Example
This shows how to upgrade a firewall to version 10.0.2. This will work regardless of which version the firewall is currently running:
from panos.firewall import Firewall fw = Firewall("10.0.0.5", "admin", "password") fw.software.upgrade_to_version("10.0.2")
Parameters: - target_version (string) – PAN-OS version (eg. “10.0.2”) or “latest”
- dryrun (bool, optional) – Log what steps would be taken, but don’t make any changes to the live device. Defaults to False.
Raises: err.PanDeviceError
– any problem during the upgrade process
-