refactor(git_utils): remove unnecessary url parameter in git_pull_wrapper

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2025-03-29 16:49:08 +01:00
parent 88742ab496
commit ea8621af0c
10 changed files with 12 additions and 15 deletions

View File

@@ -72,7 +72,7 @@ def install_crowsnest() -> None:
Logger.print_info("Installer will prompt you for sudo password!") Logger.print_info("Installer will prompt you for sudo password!")
try: try:
run( run(
f"sudo make install", "sudo make install",
cwd=CROWSNEST_DIR, cwd=CROWSNEST_DIR,
shell=True, shell=True,
check=True, check=True,
@@ -134,7 +134,7 @@ def update_crowsnest() -> None:
target=CROWSNEST_BACKUP_DIR, target=CROWSNEST_BACKUP_DIR,
) )
git_pull_wrapper(CROWSNEST_REPO, CROWSNEST_DIR) git_pull_wrapper(CROWSNEST_DIR)
deps = parse_packages_from_file(CROWSNEST_INSTALL_SCRIPT) deps = parse_packages_from_file(CROWSNEST_INSTALL_SCRIPT)
check_install_dependencies({*deps}) check_install_dependencies({*deps})

View File

@@ -162,7 +162,7 @@ class KlipperSetupService:
backup_klipper_dir() backup_klipper_dir()
InstanceManager.stop_all(self.klipper_list) InstanceManager.stop_all(self.klipper_list)
git_pull_wrapper("", KLIPPER_DIR) git_pull_wrapper(KLIPPER_DIR)
install_klipper_packages() install_klipper_packages()
install_python_requirements(KLIPPER_ENV_DIR, KLIPPER_REQ_FILE) install_python_requirements(KLIPPER_ENV_DIR, KLIPPER_REQ_FILE)
InstanceManager.start_all(self.klipper_list) InstanceManager.start_all(self.klipper_list)

View File

@@ -126,7 +126,7 @@ def update_klipperscreen() -> None:
if settings.kiauh.backup_before_update: if settings.kiauh.backup_before_update:
backup_klipperscreen_dir() backup_klipperscreen_dir()
git_pull_wrapper(KLIPPERSCREEN_REPO, KLIPPERSCREEN_DIR) git_pull_wrapper(KLIPPERSCREEN_DIR)
install_python_requirements(KLIPPERSCREEN_ENV_DIR, KLIPPERSCREEN_REQ_FILE) install_python_requirements(KLIPPERSCREEN_ENV_DIR, KLIPPERSCREEN_REQ_FILE)

View File

@@ -261,7 +261,7 @@ def update_moonraker() -> None:
instances = get_instances(Moonraker) instances = get_instances(Moonraker)
InstanceManager.stop_all(instances) InstanceManager.stop_all(instances)
git_pull_wrapper("", target_dir=MOONRAKER_DIR) git_pull_wrapper(MOONRAKER_DIR)
# install possible new system packages # install possible new system packages
install_moonraker_packages() install_moonraker_packages()

View File

@@ -106,7 +106,7 @@ def update_client_config(client: BaseWebClient) -> None:
if settings.kiauh.backup_before_update: if settings.kiauh.backup_before_update:
backup_client_config_data(client) backup_client_config_data(client)
git_pull_wrapper(client_config.repo_url, client_config.config_dir) git_pull_wrapper(client_config.config_dir)
Logger.print_ok(f"Successfully updated {client_config.display_name}.") Logger.print_ok(f"Successfully updated {client_config.display_name}.")
Logger.print_info("Restart Klipper to reload the configuration!") Logger.print_info("Restart Klipper to reload the configuration!")

View File

@@ -104,7 +104,7 @@ class MobilerakerExtension(BaseExtension):
if settings.kiauh.backup_before_update: if settings.kiauh.backup_before_update:
self._backup_mobileraker_dir() self._backup_mobileraker_dir()
git_pull_wrapper(MOBILERAKER_REPO, MOBILERAKER_DIR) git_pull_wrapper(MOBILERAKER_DIR)
install_python_requirements(MOBILERAKER_ENV_DIR, MOBILERAKER_REQ_FILE) install_python_requirements(MOBILERAKER_ENV_DIR, MOBILERAKER_REQ_FILE)

View File

@@ -145,7 +145,7 @@ class ObicoExtension(BaseExtension):
instances = get_instances(MoonrakerObico) instances = get_instances(MoonrakerObico)
InstanceManager.stop_all(instances) InstanceManager.stop_all(instances)
git_pull_wrapper(OBICO_REPO, OBICO_DIR) git_pull_wrapper(OBICO_DIR)
self._install_dependencies() self._install_dependencies()
InstanceManager.start_all(instances) InstanceManager.start_all(instances)

View File

@@ -78,7 +78,7 @@ class PrettyGcodeExtension(BaseExtension):
def update_extension(self, **kwargs) -> None: def update_extension(self, **kwargs) -> None:
Logger.print_status("Updating PrettyGCode for Klipper ...") Logger.print_status("Updating PrettyGCode for Klipper ...")
try: try:
git_pull_wrapper(PGC_REPO, PGC_DIR) git_pull_wrapper(PGC_DIR)
except Exception as e: except Exception as e:
Logger.print_error(f"Error during PrettyGCode for Klipper update: {e}") Logger.print_error(f"Error during PrettyGCode for Klipper update: {e}")

View File

@@ -135,7 +135,7 @@ class TelegramBotExtension(BaseExtension):
instances = get_instances(MoonrakerTelegramBot) instances = get_instances(MoonrakerTelegramBot)
InstanceManager.stop_all(instances) InstanceManager.stop_all(instances)
git_pull_wrapper(TG_BOT_REPO, TG_BOT_DIR) git_pull_wrapper(TG_BOT_DIR)
self._install_dependencies() self._install_dependencies()
InstanceManager.start_all(instances) InstanceManager.start_all(instances)

View File

@@ -58,17 +58,14 @@ def git_clone_wrapper(
raise GitException(f"Error removing existing repository: {e.strerror}") raise GitException(f"Error removing existing repository: {e.strerror}")
# !todo: remove url parameter, as it is not really required. may be a reason to remove this function completely def git_pull_wrapper(target_dir: Path) -> None:
def git_pull_wrapper(url: str, target_dir: Path) -> None:
""" """
A function that updates a repository using git pull. A function that updates a repository using git pull.
:param url: The repo url - only used for logging.
:param target_dir: The directory of the repository. :param target_dir: The directory of the repository.
:return: None :return: None
""" """
_repo = f"'{url}'" if url else "" Logger.print_status("Updating repository ...")
Logger.print_status(f"Updating repository {_repo}...")
try: try:
git_cmd_pull(target_dir) git_cmd_pull(target_dir)
except CalledProcessError: except CalledProcessError: