From 17f482f78e3f87c35a7e48f546a4b36964f54642 Mon Sep 17 00:00:00 2001 From: Calvin Remsburg Date: Fri, 19 Jan 2024 11:04:46 -0600 Subject: [PATCH] moving project files --- pan_os_upgrade/__init__.py | 0 {models => pan_os_upgrade/models}/__init__.py | 0 .../models}/arp_table.py | 0 .../models}/assurance_report.py | 0 .../models}/content_version.py | 0 .../models}/ip_sec_tunnel.py | 0 {models => pan_os_upgrade/models}/license.py | 0 {models => pan_os_upgrade/models}/nics.py | 0 {models => pan_os_upgrade/models}/routes.py | 0 .../models}/session_stats.py | 0 upgrade.py => pan_os_upgrade/upgrade.py | 19 ++++++++++++++++--- 11 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 pan_os_upgrade/__init__.py rename {models => pan_os_upgrade/models}/__init__.py (100%) rename {models => pan_os_upgrade/models}/arp_table.py (100%) rename {models => pan_os_upgrade/models}/assurance_report.py (100%) rename {models => pan_os_upgrade/models}/content_version.py (100%) rename {models => pan_os_upgrade/models}/ip_sec_tunnel.py (100%) rename {models => pan_os_upgrade/models}/license.py (100%) rename {models => pan_os_upgrade/models}/nics.py (100%) rename {models => pan_os_upgrade/models}/routes.py (100%) rename {models => pan_os_upgrade/models}/session_stats.py (100%) rename upgrade.py => pan_os_upgrade/upgrade.py (99%) diff --git a/pan_os_upgrade/__init__.py b/pan_os_upgrade/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/models/__init__.py b/pan_os_upgrade/models/__init__.py similarity index 100% rename from models/__init__.py rename to pan_os_upgrade/models/__init__.py diff --git a/models/arp_table.py b/pan_os_upgrade/models/arp_table.py similarity index 100% rename from models/arp_table.py rename to pan_os_upgrade/models/arp_table.py diff --git a/models/assurance_report.py b/pan_os_upgrade/models/assurance_report.py similarity index 100% rename from models/assurance_report.py rename to pan_os_upgrade/models/assurance_report.py diff --git a/models/content_version.py b/pan_os_upgrade/models/content_version.py similarity index 100% rename from models/content_version.py rename to pan_os_upgrade/models/content_version.py diff --git a/models/ip_sec_tunnel.py b/pan_os_upgrade/models/ip_sec_tunnel.py similarity index 100% rename from models/ip_sec_tunnel.py rename to pan_os_upgrade/models/ip_sec_tunnel.py diff --git a/models/license.py b/pan_os_upgrade/models/license.py similarity index 100% rename from models/license.py rename to pan_os_upgrade/models/license.py diff --git a/models/nics.py b/pan_os_upgrade/models/nics.py similarity index 100% rename from models/nics.py rename to pan_os_upgrade/models/nics.py diff --git a/models/routes.py b/pan_os_upgrade/models/routes.py similarity index 100% rename from models/routes.py rename to pan_os_upgrade/models/routes.py diff --git a/models/session_stats.py b/pan_os_upgrade/models/session_stats.py similarity index 100% rename from models/session_stats.py rename to pan_os_upgrade/models/session_stats.py diff --git a/upgrade.py b/pan_os_upgrade/upgrade.py similarity index 99% rename from upgrade.py rename to pan_os_upgrade/upgrade.py index c6a83d5..2347728 100644 --- a/upgrade.py +++ b/pan_os_upgrade/upgrade.py @@ -111,7 +111,7 @@ class AssuranceOptions: }, "free_disk_space": { "description": "Check if a there is enough space on the `/opt/panrepo` volume for downloading an PanOS image.", - "log_level": "error", + "log_level": "warning", "exit_on_failure": False, }, "ha": { @@ -393,7 +393,6 @@ def parse_arguments() -> Args: elif not (arguments["pan_username"] and arguments["pan_password"]): logging.error( f"{get_emoji('error')} Provide either API key --api-key argument or both --username and --password", - file=sys.stderr, ) logging.error(f"{get_emoji('stop')} Halting script.") @@ -1516,7 +1515,7 @@ def perform_reboot(firewall: Firewall, ha_details: Optional[dict] = None) -> Non rebooted = True else: logging.info( - f"{get_emoji('working')} Waiting for firewall to reboot and synchronize..." + f"{get_emoji('working')} Firewall is responding to requests but hasn't finished its reboot process..." ) time.sleep(30) @@ -1559,6 +1558,20 @@ def main() -> None: - If the HA peer state is not synchronized. - Upon completion of a dry run. """ + + # Create necessary directories + directories = [ + "logs", + "assurance", + "assurance/configurations", + "assurance/readiness_checks", + "assurance/reports", + "assurance/snapshots", + ] + for dir in directories: + ensure_directory_exists(os.path.join(dir, "dummy_file")) + + # Configure logging right after directory setup args = parse_arguments() configure_logging(args["log_level"])