From 36b8e130ea629c61b8c071e68d335adf7623bf3c Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Tue, 12 Mar 2024 16:13:59 +0100 Subject: [PATCH] fix(ssh-setup-agent): correctly parse result In dbd32b04 we switched to run_cmd to execute the ssh-agent. However, this wrapper returns the output as a single string instead of line-chunks. By that, we iterated over the single characters instead of the lines which broke the key-value parsing. This patch fixes this by splitting the string at the end-of-line delimiter. Reported-by: Jasper Orschulko Signed-off-by: Felix Moessbauer Signed-off-by: Jan Kiszka --- kas/libkas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kas/libkas.py b/kas/libkas.py index 118454ef..74210b18 100644 --- a/kas/libkas.py +++ b/kas/libkas.py @@ -357,7 +357,7 @@ def ssh_setup_agent(envkeys=None): envkeys = envkeys or ['SSH_PRIVATE_KEY', 'SSH_PRIVATE_KEY_FILE'] (_, output) = run_cmd(['ssh-agent', '-s'], env=env, cwd=ctx.kas_work_dir) - for line in output: + for line in output.split('\n'): matches = re.search(r"(\S+)\=(\S+)\;", line) if matches: env[matches.group(1)] = matches.group(2)