Skip to content

Commit

Permalink
Updated code with single if entry and filtered list
Browse files Browse the repository at this point in the history
  • Loading branch information
horiagunica committed Mar 6, 2024
1 parent a21ea3f commit 4a09a07
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions panos_upgrade_assurance/firewall_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,10 @@ 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 = list(filter(None, 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
elif pan_status_list_length in [3, 6]:
if pan_status_list_length in [3, 6]:
for i in range(1, pan_status_list_length, 3):
pan_connected = interpret_yes_no((pan_status_list[i].split(":")[1]).strip())
if pan_connected:
Expand Down

0 comments on commit 4a09a07

Please sign in to comment.