From ef3b6ab853a353b91aa0cfe2a00fb4a3cf3dc6b9 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Mon, 26 Jan 2026 20:46:31 -0500 Subject: [PATCH] Refactor auth_handler to use dependency injection (#4171) --- archinstall/lib/authentication/authentication_handler.py | 3 --- archinstall/scripts/guided.py | 9 +++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/archinstall/lib/authentication/authentication_handler.py b/archinstall/lib/authentication/authentication_handler.py index b4200866..14c6d147 100644 --- a/archinstall/lib/authentication/authentication_handler.py +++ b/archinstall/lib/authentication/authentication_handler.py @@ -126,6 +126,3 @@ class AuthenticationHandler: existing_keys = all_keys u2f_auth_file.write_text(existing_keys) - - -auth_handler = AuthenticationHandler() diff --git a/archinstall/scripts/guided.py b/archinstall/scripts/guided.py index ffc80f52..aa0d878e 100644 --- a/archinstall/scripts/guided.py +++ b/archinstall/scripts/guided.py @@ -4,7 +4,7 @@ from pathlib import Path from archinstall.lib.applications.application_handler import application_handler from archinstall.lib.args import arch_config_handler -from archinstall.lib.authentication.authentication_handler import auth_handler +from archinstall.lib.authentication.authentication_handler import AuthenticationHandler from archinstall.lib.configuration import ConfigurationOutput from archinstall.lib.disk.filesystem import FilesystemHandler from archinstall.lib.disk.utils import disk_layouts @@ -54,6 +54,7 @@ def ask_user_questions(mirror_list_handler: MirrorListHandler) -> None: def perform_installation( mountpoint: Path, mirror_list_handler: MirrorListHandler, + auth_handler: AuthenticationHandler, ) -> None: """ Performs the installation steps on a block device. @@ -219,7 +220,11 @@ def guided() -> None: fs_handler = FilesystemHandler(arch_config_handler.config.disk_config) fs_handler.perform_filesystem_operations() - perform_installation(arch_config_handler.args.mountpoint, mirror_list_handler) + perform_installation( + arch_config_handler.args.mountpoint, + mirror_list_handler, + AuthenticationHandler(), + ) guided()