Setup#

Summary

The Setup class handles the initial setup of Patcher the first time it is executed. For additional reference, visit the Setup page in the User Guide.

class Setup(config: ConfigManager, ui_config: UIConfigManager, custom_ca_file: str | None = None)[source]#

Handles the initial setup process for the Patcher CLI tool.

This class guides users through configuring the necessary components to integrate with their Jamf environment. The setup includes creating API roles, clients, and configuring user interface settings for PDF reports.

Initializes the Setup class with configuration and UI configuration managers.

Parameters:
  • config (ConfigManager) – Manages application configuration, including credential storage.

  • ui_config (UIConfigManager) – Handles UI-related configurations for the setup process.

  • custom_ca_file (Optional[str]) – Path to a custom CA file for SSL verification, if needed.

property completed: bool#

Indicates whether the setup process has been completed.

Returns:

True if setup has been completed, False otherwise.

Return type:

bool

async prompt_method(animator: Animation | None = None)[source]#

Allows the user to choose between different setup methods (Standard or SSO).

This method enhances the user experience by guiding them through the appropriate setup steps based on their environment.

Parameters:

animator (Optional[Animation]) – Animation object to pass to methods for progress updates. Defaults to self.animator.

async first_run()[source]#

Initiates the setup process for users utilizing SSO.

This method handles the necessary steps for generating and saving API client credentials when the user is operating in an SSO environment.

Raises:
  • SystemExit – If the user opts not to proceed with the setup.

  • exceptions.TokenFetchError – If there is an error fetching the token.

async launch(animator: Animation | None = None)[source]#

Launches the setup assistant for the Patcher tool.

This method prompts the user for necessary information and handles the entire setup process, including API role creation, client creation, and saving credentials.

Parameters:

animator (Optional[Animation]) – The animation instance to update messages. Defaults to self.animator.

Raises:
  • SystemExit – If the user opts not to proceed with the setup.

  • exceptions.TokenFetchError – If the API call to retrieve a token fails.

  • aiohttp.ClientError – If there is an error making the HTTP request.

async reset()[source]#

Resets the UI configuration settings by clearing the existing configuration and starting the setup process again.

This method is useful if the user wants to reconfigure the UI elements of PDF reports, such as header/footer text and font choices.