-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from cdot65/30-enhancement-replace-argparse-wi…
…th-click-for-cli-argument-handling-in-pan-os-upgrade Update dependencies and replace argparse with typer
- Loading branch information
Showing
9 changed files
with
452 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Release Notes | ||
|
||
Welcome to the release notes for the `pan-os-upgrade` tool. This document provides a detailed record of changes, enhancements, and fixes in each version of the tool. | ||
|
||
## Version 0.2.0 | ||
|
||
**Release Date:** *<20240121>* | ||
|
||
### What's New | ||
|
||
- Allow for simply running `pan-os-upgrade` without arguments, providing an interactive prompt for missing variables | ||
- Replaced `argparse` with `typer` for command-line argument parsing, offering a more intuitive and user-friendly CLI experience. | ||
- Removed the option for API key authentication to streamline the authentication process. | ||
- Removed the `.env` file lookup feature. Configuration is now exclusively handled through command-line arguments. | ||
- Updated the `hostname` variable to `ip_address` for clarity and consistency. | ||
- Changed `target_version` parameter name to simply `version` to make it more concise. | ||
|
||
### Breaking Changes | ||
|
||
- Scripts and automation tools using the previous `argparse` syntax or `.env` file for configuration will need to be updated to use the new `typer` CLI arguments. | ||
|
||
## Version 0.1.1 | ||
|
||
**Release Date:** *<20240119>* | ||
|
||
### Highlights | ||
|
||
- First official release of the `pan-os-upgrade` tool on PyPi. | ||
- Made available for wide usage and distribution. | ||
|
||
### Notes | ||
|
||
- Includes all the features and functionalities as they were in the initial development build. | ||
|
||
## Version 0.1.0 | ||
|
||
**Release Date:** *<20240118>* | ||
|
||
### Introduction | ||
|
||
- Initial development build of the `pan-os-upgrade` tool. | ||
- Laid down the foundation for the tool's functionalities and features. | ||
|
||
--- | ||
|
||
For more detailed information on each release, visit the [GitHub repository](https://github.com/cdot65/pan-os-upgrade/releases) or check the [commit history](https://github.com/cdot65/pan-os-upgrade/commits/main). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,51 @@ | ||
# Configuration Guide for pan-os-upgrade | ||
|
||
Proper configuration is crucial for the effective use of the `pan-os-upgrade` package. There are two main methods to configure the tool: using a `.env` file or passing command-line arguments. Each method has its strengths and weaknesses, which we'll explore below. | ||
Proper configuration is vital for the effective use of the `pan-os-upgrade` package. As of the latest update, configuration can be done primarily through command-line arguments. | ||
|
||
## Option 1: Using a `.env` File | ||
## Executing `pan-os-upgrade` | ||
|
||
A `.env` file is a simple way to store configuration settings in key-value pairs. This method is advantageous for keeping your configuration organized and easily editable in one place. | ||
### Option 1: Execute Without Command-Line Arguments | ||
|
||
**Creating a `.env` File:** | ||
You can start the script by simply issuing `pan-os-upgrade` from your current working directory. The interactive shell will prompt you to input the required arguments. | ||
|
||
1. Create a `.env` file in your project's root directory. | ||
2. Add your firewall's details to the file, as shown below: | ||
|
||
```env | ||
# PAN-OS credentials - use either API key or username/password combination | ||
PAN_USERNAME=admin | ||
PAN_PASSWORD=paloalto123 | ||
API_KEY= | ||
# Hostname or IP address of the firewall | ||
HOSTNAME=firewall1.example.com | ||
# Target PAN-OS version for the upgrade | ||
TARGET_VERSION=11.0.2-h3 | ||
# Logging level (e.g., debug, info, warning, error, critical) | ||
LOG_LEVEL=debug | ||
# Set to true for a dry run | ||
DRY_RUN=false | ||
```bash | ||
$ pan-os-upgrade | ||
IP address: 192.168.255.1 | ||
Username: admin | ||
Password: | ||
Target PAN-OS version: 11.1.1 | ||
...output... | ||
``` | ||
|
||
**Pros:** | ||
|
||
- Centralized configuration management. | ||
- Easy to update or modify settings. | ||
|
||
**Cons:** | ||
### Option 2: Execute Using Command-Line Arguments | ||
|
||
- Risk of committing sensitive information to a version control system if not properly ignored. | ||
- Less flexibility for dynamic or per-run configurations. | ||
|
||
## Option 2: Using Command-Line Arguments | ||
|
||
Command-line arguments offer a direct way to pass configuration settings each time you run the script. | ||
|
||
**Passing Details via Command-Line:** | ||
|
||
- Standard Usage: | ||
Alternatively, you can pass these details as command-line arguments: | ||
|
||
```bash | ||
pan-os-upgrade --hostname 192.168.1.1 --username admin --password secret --version 10.1.0 | ||
$ pan-os-upgrade --ip-address 192.168.1.1 --username admin --password secret --version 10.1.0 | ||
``` | ||
|
||
- For a Dry Run: | ||
For a dry run: | ||
|
||
```bash | ||
pan-os-upgrade --hostname 192.168.1.1 --username admin --password secret --version 10.1.0 --dry-run | ||
$ pan-os-upgrade --ip-address 192.168.1.1 --username admin --password secret --version 10.1.0 --dry-run | ||
``` | ||
|
||
**Pros:** | ||
|
||
- Greater control and flexibility for each run. | ||
- Avoids storing sensitive details in a file. | ||
|
||
**Cons:** | ||
|
||
- Risk of exposing sensitive information in console history. | ||
- Less convenient for repeated use with the same settings. | ||
|
||
## CLI Arguments Description | ||
|
||
When using command-line arguments, the following options are available: | ||
|
||
| argument | description | required | | ||
| ------------- | ------------------------------------------------------------------------- | --------- | | ||
| `--api-key` | API Key for authentication | required* | | ||
| `--dry-run` | Dry run of all tests and downloads without performing the actual upgrade. | optional | | ||
| `--hostname` | Hostname or IP address of the PAN-OS firewall. | optional | | ||
| `--log-level` | Set the logging output level (e.g., debug, info, warning). | optional | | ||
| `--password` | Password for authentication. | required* | | ||
| `--username` | Username for authentication. | required* | | ||
| `--version` | Target PAN-OS version to upgrade to. | required | | ||
| Argument | Description | Required | | ||
| -------------- | -------------------------------------------------------------------- | -------- | | ||
| `--ip-address` | IP address of the target PAN-OS firewall. | Yes | | ||
| `--username` | Username for authentication with the firewall. | Yes | | ||
| `--password` | Password for authentication with the firewall. | Yes | | ||
| `--version` | Target PAN-OS version to upgrade to. | Yes | | ||
| `--dry-run` | Perform a dry run of all tests and downloads without actual upgrade. | No | | ||
| `--log-level` | Set the logging output level (e.g., debug, info, warning). | No | | ||
|
||
<small>* if using a <code>--api-key</code> for authentication, omit the <code>--username</code> and <code>--password</code> arguments; opposite is also true.</small> | ||
Note: The use of an API key and `.env` file for configuration is no longer supported. | ||
|
||
## Next Steps | ||
|
||
After configuring `pan-os-upgrade`, you're ready to execute the upgrade process. To learn more about the execution steps and options, proceed to the [Execution Guide](execution.md). | ||
After configuring `pan-os-upgrade`, you're ready to execute the upgrade process. For more details on execution steps and options, proceed to the [Execution Guide](execution.md). |
Oops, something went wrong.