From a80b27d0bdac0ed8761f43912436bf5028a2f9a4 Mon Sep 17 00:00:00 2001 From: Anri Dellal Date: Mon, 31 Mar 2025 17:02:58 +0300 Subject: [PATCH] install: Do not fail on invalid SSH key Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2576 --- pmb/install/_install.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 1d16629f..1921c520 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -308,7 +308,13 @@ def copy_ssh_keys(config: Config) -> None: keys = [] for key in glob.glob(os.path.expanduser(config.ssh_key_glob)): with open(key) as infile: - keys += infile.readlines() + try: + keys += infile.readlines() + except UnicodeDecodeError: + logging.info( + f"WARNING: {key} is not a valid SSH key. " + "This file will not be copied to device." + ) if not len(keys): logging.info(