Skip to content

Commit

Permalink
Add health check to list of checks
Browse files Browse the repository at this point in the history
  • Loading branch information
adambaumeister committed Jan 16, 2024
1 parent 3d7060e commit 25c3a29
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions examples/readiness_checks/run_health_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@
vsys = args.vsys

if serial:
print(address)
panorama = Panorama(
hostname=address, api_password=password, api_username=username
)
firewall = FirewallProxy(serial=serial)
panorama.add(firewall)
panorama.add(firewall._fw)
else:
firewall = FirewallProxy(
hostname=address, api_password=password, api_username=username, vsys=vsys
Expand All @@ -79,7 +80,8 @@
check_node = CheckFirewall(firewall)

checks = [
"device_root_certificate_issue"
"device_root_certificate_issue",
"check_cdss_and_panorama_certificate_issue"
]

check_health = check_node.run_health_checks(
Expand Down
12 changes: 11 additions & 1 deletion panos_upgrade_assurance/check_firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def __init__(self, node: FirewallProxy, skip_force_locale: Optional[bool] = Fals
CheckType.JOBS: self.check_non_finished_jobs,
}

self._health_check_method_mapping = {HealthType.DEVICE_ROOT_CERTIFICATE_ISSUE: self.check_device_root_certificate_issue}
self._health_check_method_mapping = {
HealthType.DEVICE_ROOT_CERTIFICATE_ISSUE: self.check_device_root_certificate_issue,
HealthType.DEVICE_CDSS_AND_PANORAMA_CERTIFICATE_ISSUE: self.check_cdss_and_panorama_certificate_issue,
}

if not skip_force_locale:
locale.setlocale(
Expand Down Expand Up @@ -1471,7 +1474,14 @@ def check_cdss_and_panorama_certificate_issue(self):
reboot_time = self._node.get_system_time_rebooted()
if reboot_time < fixed_content_version_release_date:
result.reason = "Device is running fixed Content but still requires a restart for the fix to take " "effect."
return result
else:
result.status = CheckStatus.SUCCESS
return result

result.reason = (
"Device is running a software version, and a content version, that is affected by the 2024 certificate"
" expiration, the first of which will occur on the 7th of April, 2024."
)

return result
1 change: 1 addition & 0 deletions panos_upgrade_assurance/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class HealthType:
"""

DEVICE_ROOT_CERTIFICATE_ISSUE = "device_root_certificate_issue"
DEVICE_CDSS_AND_PANORAMA_CERTIFICATE_ISSUE = "check_cdss_and_panorama_certificate_issue"


class CheckStatus(Enum):
Expand Down

0 comments on commit 25c3a29

Please sign in to comment.