Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(firewall_proxy/is_panorama_connected): Added fix for panorama check for FWs in version PAN-OS 11 or later #159

Merged
merged 5 commits into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions panos_upgrade_assurance/firewall_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,15 @@ def is_panorama_connected(self) -> bool:
if not isinstance(pan_status, str):
raise exceptions.MalformedResponseException("Response from device is not type of string.")

pan_status_list = pan_status.split("\n")
pan_status_list_length = len(pan_status_list)

if pan_status_list_length in [3, 7]:
for i in range(1, pan_status_list_length, 4):
pan_connected = interpret_yes_no((pan_status_list[i].split(":")[1]).strip())
if pan_connected:
return True
if re.search(r"connected\s*:\s*yes", pan_status, re.IGNORECASE):
return True
elif re.search(r"connected\s*:\s*no", pan_status, re.IGNORECASE):
return False
else:
raise exceptions.MalformedResponseException(
f"Panorama configuration block does not have typical structure: <{pan_status}>."
)

return False

def get_ha_configuration(self) -> dict:
"""Get high-availability configuration status.

Expand Down
Loading