cdot65 / pan-os-upgrade

An efficient tool to execute configuration backups, network state snapshots, system readiness checks, and operating system upgrades of Palo Alto Networks firewalls and Panorama appliances.
https://cdot65.github.io/pan-os-upgrade/
Apache License 2.0
43 stars 9 forks source link

109 implement safeguards to prevent upgrades that may cause ha pair incompatibility #113

Closed cdot65 closed 8 months ago

cdot65 commented 8 months ago

Here's a refined PR description based on the provided GitHub issue and changes:

Checklist for This Pull Request

🚨Please adhere to the guidelines for contributing to this repository.

Pull Request Description

This pull request introduces a safeguard feature in the pan-os-upgrade tool to prevent compatibility issues when upgrading PAN-OS firewalls in an HA pair. The feature gracefully exits the upgrade process if the user selects an upgrade version that is two or more minor releases ahead of the current version and the firewalls are in an HA state.

What does this pull request accomplish?

Are there any breaking changes included?

Changes made in this pull request

Resolves issue

Resolves #109

Motivation behind this feature

When upgrading PAN-OS firewalls in an HA pair, selecting a version that is two or more minor releases ahead of the current version can lead to compatibility issues. If one firewall is upgraded to a version that is significantly ahead of its peer, it may not be able to rejoin the HA pair after the upgrade, putting itself in a suspended state. When the upgrade process begins on the other firewall, it issues an HA state switch over. If the peer is in a suspended state, neither firewall will be able to forward traffic, as they both operate in a suspended state.

This safeguard feature mitigates this issue by gracefully exiting the upgrade process when the specified conditions are met. It helps prevent users from accidentally causing HA pair incompatibility issues and ensures they are aware of the potential consequences before proceeding with the upgrade.

Is there anything the reviewers should know?

Please review the changes carefully, especially the logic in the check_ha_compatibility function, to ensure it accurately identifies potential compatibility issues based on the version numbers and HA state.