Skip to content

Commit

Permalink
fix(firewall_proxy/is_panorama_connected): Added fix for panorama che…
Browse files Browse the repository at this point in the history
…ck for FWs in version PAN-OS 11 or later (#159)
  • Loading branch information
horiagunica authored Mar 7, 2024
1 parent fc5f251 commit e617dbc
Showing 1 changed file with 4 additions and 10 deletions.
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

0 comments on commit e617dbc

Please sign in to comment.