Skip to content

Commit

Permalink
fix(ssh-setup-agent): correctly parse result
Browse files Browse the repository at this point in the history
In dbd32b0 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 <[email protected]>
Signed-off-by: Felix Moessbauer <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
fmoessbauer authored and jan-kiszka committed Mar 12, 2024
1 parent a5c2202 commit 36b8e13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kas/libkas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 36b8e13

Please sign in to comment.