Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Use the new knownhosts package in fluxcd/toolkit #617

Merged
merged 3 commits into from
Jun 11, 2020

Conversation

luxas
Copy link
Contributor

@luxas luxas commented Jun 11, 2020

Copy link
Contributor

@twelho twelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍, one nit with the path expansion.

return "", fmt.Errorf("Couldn't lookup home directory for user")
}
// replace the first tilde in the path with $HOME
return strings.Replace(path, "~", homeEnv, 1), nil
Copy link
Contributor

@twelho twelho Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will perform an illicit replace if the ~ is not the first character of the string. We should likely do something like this (which also retrieves the home directory correctly): https://stackoverflow.com/a/43578461 if this function is really needed (see other comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -61,9 +67,24 @@ func NewCmdGitOps(out io.Writer) *cobra.Command {
}
if f.identityFile != "" {
var err error
// support ~ prefixes in the path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you verified that this is necessary, since the shell will expand ~ before it is passed to the program? Unless this this config is read from a file, I don't see the need to do manual path expansion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is needed, as we have the (non-expanded) part as a default

@luxas luxas merged commit 924712a into weaveworks:master Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants