Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0 #24

Merged
merged 138 commits into from
Jan 23, 2025
Merged

v2.0 #24

merged 138 commits into from
Jan 23, 2025

Conversation

liquidz00
Copy link
Owner

What's Changed

Patcher v2.0 brings a few new 'breaking' changes.

Subcommands

Entry point is now split into three separate commands: export, reset, and analyze:

  • export exports patch management data into Excel and PDF reports, with same options that can be passed (e.g., sort, omit, etc.)
  • reset resets end-user configuration settings by kind (full, creds, UI or cache)
  • analyze analyzes the last exported dataset by passed criteria, returns a formatted table to stdout.

Data Caching

The ExcelReport class has been refactored into a more robust DataManager class. It now handles automatic caching of patch reports using pickle files (*.pkl). The analyze command automatically gathers the latest exported patch report so end-users do not have to pass one. The analyze command does support providing a separate or alternate patch report for analysis by passing the --excel-file option.

Data caching can be disabled at any time by passing the --disable-cache flag to any command.

Logging and Error Handling

Logging configuration and custom exceptions have been overhauled. Previous versions 'over-logged' in the sense low-level functions/methods would log messages, resulting in duplicate log entries. Log entries are now propagated to callers, and tracebacks properly formatted to log files. Log entries with potentially sensitive information (JSS URL, API credentials, etc) are sanitized before being written to the log file for security purposes.

Tracebacks no longer show in stdout/stderr unless the global --debug flag is passed. Error handling has been improved to show clearly formatted errors instead of long confusing tracebacks. Exit codes have been strategically implemented depending on type of issue encountered.

Minor improvements

  • Project documentation has been updated with new functionality, with some minor design changes.
  • Help page has been formatted to be short and succinct, and can be triggered with either --help or -h:
Usage: python -m patcher.cli <options> COMMAND [ARGS]...

  Main CLI entry point for Patcher.

  Visit our project documentation for full details:
  https://patcher.liquidzoo.io.

  Exit Codes:
      0   Success
      1   General error (e.g., PatcherError or user-facing issue)
      2   Unhandled exception
      4   API error (e.g., unauthorized, invalid response)
      130 KeyboardInterrupt (Ctrl+C)

Options:
  --version        Show the version and exit.
  -x, --debug      Enable debug logging (verbose mode).
  --disable-cache  Disable automatic caching of patch report data.
  -h, --help       Show this message and exit.

Commands:
  analyze  Analyzes exported data by criteria.
  export   Exports patch management reports.
  reset    Resets configuration based on kind.

Each command has a help menu that can be shown using patcherctl <command> --help.

…ogHandler class and format traceback functionality.
@liquidz00 liquidz00 added the enhancement New feature or request label Jan 15, 2025
@liquidz00 liquidz00 requested a review from ball42 January 15, 2025 20:40
# Conflicts:
#	Makefile
#	README.md
#	docs/_static/css/custom.css
#	docs/user/customize_reports.rst
#	pyproject.toml
@liquidz00 liquidz00 merged commit 3d1f926 into main Jan 23, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants