From 26165a553de603c2ba465ba3dc932708869475d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Gonz=C3=A1lez?= Date: Tue, 19 Aug 2025 01:22:02 +0000 Subject: [PATCH] [FIX] travis2docker: don't overwrite existing keys When granting access to SSH keys by adding the same public key to the `authorized_keys` file, the existing file was being overwritten, because the mode "w" was being used instead of "a". This is the equivalent of using `>` instead of `>>` in shell. To solve this, the "a" mode is now used. --- src/travis2docker/travis2docker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/travis2docker/travis2docker.py b/src/travis2docker/travis2docker.py index d653b25..82fde7a 100644 --- a/src/travis2docker/travis2docker.py +++ b/src/travis2docker/travis2docker.py @@ -402,5 +402,5 @@ def set_authorized_key(self): with open(to_copy, "r", encoding="utf-8") as key_fd: pub_key = key_fd.read() - with open(os.path.join(self.curr_work_path, ".ssh", "authorized_keys"), "w", encoding="utf-8") as auth_fd: + with open(os.path.join(self.curr_work_path, ".ssh", "authorized_keys"), "a", encoding="utf-8") as auth_fd: auth_fd.write(pub_key)