From df7793916c6551d5870a6bd0cad46dad6b0a1636 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 6 Feb 2026 11:39:04 -0800 Subject: [PATCH] backups: Fix type checking errors - Use the passed in argument for copy_ssh_client_public_key instead of overwriting it. Signed-off-by: Sunil Mohan Adapa --- plinth/modules/backups/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plinth/modules/backups/__init__.py b/plinth/modules/backups/__init__.py index 55cfb50e1..2704e0bdb 100644 --- a/plinth/modules/backups/__init__.py +++ b/plinth/modules/backups/__init__.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """FreedomBox app to manage backup archives.""" +import collections.abc import contextlib import json import logging @@ -180,14 +181,13 @@ def copy_ssh_client_public_key(pubkey_path: str, hostname: str, username: str, Returns whether the copy was successful, and any error message. """ - pubkey_path, _ = get_ssh_client_auth_key_paths() env = os.environ.copy() env['SSHPASS'] = str(password) with raise_ssh_error(): try: subprocess.run([ - 'sshpass', '-e', 'ssh-copy-id', '-i', - str(pubkey_path), f'{username}@{hostname}' + 'sshpass', '-e', 'ssh-copy-id', '-i', pubkey_path, + f'{username}@{hostname}' ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, env=env) logger.info("Copied SSH client public key to remote host's " @@ -199,7 +199,7 @@ def copy_ssh_client_public_key(pubkey_path: str, hostname: str, username: str, @contextlib.contextmanager -def raise_ssh_error() -> None: +def raise_ssh_error() -> collections.abc.Generator[None]: """Convert subprocess error to SshError.""" try: yield