Skip to content

Commit

Permalink
kola: spawn: Fix detach option
Browse files Browse the repository at this point in the history
Ignition v3 does not tolerate duplicate ssh keys, which we will often get if we
fetch them from ssh-agent and from the filesystem. Implement key deduplication
in GetSSHKeys(), which is called when `-t` is passed.

Signed-off-by: Jeremi Piotrowski <[email protected]>
  • Loading branch information
jepio committed Mar 5, 2025
1 parent dac7736 commit 3576b9f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,5 +417,15 @@ func GetSSHKeys(sshKeys []string) ([]agent.Key, error) {
allKeys = append(allKeys, key)
}

// Ignition v3 does not allow duplicate keys so we need to deduplicate
allUniqueKeys := make(map[string]*agent.Key)
for _, key := range allKeys {
allUniqueKeys[string(key.Blob)] = &key
}
allKeys = []agent.Key{}
for _, value := range allUniqueKeys {
allKeys = append(allKeys, *value)
}

return allKeys, nil
}

0 comments on commit 3576b9f

Please sign in to comment.