cdot65 / pan-os-upgrade

An efficient tool to execute configuration backups, network state snapshots, system readiness checks, and operating system upgrades of Palo Alto Networks firewalls and Panorama appliances.
https://cdot65.github.io/pan-os-upgrade/
Apache License 2.0
39 stars 9 forks source link

TypeError on CLI Invocation Post Typer Integration: Missing Required Positional Arguments #33

Closed cdot65 closed 9 months ago

cdot65 commented 9 months ago

Issue Summary

After integrating Typer into the pan-os-upgrade script to handle command-line arguments, executing the script via CLI results in a TypeError, indicating missing required positional arguments. This behavior was observed subsequent to the replacement of direct function calls in the script entry point with Typer's CLI runner.

Steps to Reproduce

Expected Behavior

The script should correctly interpret and accept command-line arguments without throwing errors, utilizing Typer's argument handling capabilities.

Actual Behavior

The script execution fails with a TypeError, stating that main() is missing 4 required positional arguments: 'ip_address', 'username', 'password', and 'target_version'.

Potential Cause

The script's entry point in pyproject.toml was not appropriately updated to reflect the change to Typer. It's currently pointing directly to the main() function, while it should be configured to invoke Typer's CLI runner (app instance) to properly handle the command-line arguments.

Suggested Fix

Modify the [tool.poetry.scripts] section in pyproject.toml to point to the Typer app instance instead of the main() function. For example:

[tool.poetry.scripts]
pan-os-upgrade = 'pan_os_upgrade.upgrade:app'