Set SSH verbosity based on git-sync -v value
This commit is contained in:
parent
97c0d585a8
commit
3d7bb94c4d
14
main.go
14
main.go
|
|
@ -764,7 +764,7 @@ func main() {
|
||||||
|
|
||||||
// If the --repo or any submodule uses SSH, we need to know which keys.
|
// If the --repo or any submodule uses SSH, we need to know which keys.
|
||||||
if err := git.SetupGitSSH(*flSSHKnownHosts, *flSSHKeyFiles, *flSSHKnownHostsFile); err != nil {
|
if err := git.SetupGitSSH(*flSSHKnownHosts, *flSSHKeyFiles, *flSSHKnownHostsFile); err != nil {
|
||||||
log.Error(err, "can't set up git SSH", "keyFile", *flSSHKeyFiles, "knownHosts", *flSSHKnownHosts, "knownHostsFile", *flSSHKnownHostsFile)
|
log.Error(err, "can't set up git SSH", "keyFiles", *flSSHKeyFiles, "useKnownHosts", *flSSHKnownHosts, "knownHostsFile", *flSSHKnownHostsFile)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1912,6 +1912,18 @@ func (git *repoSync) SetupGitSSH(setupKnownHosts bool, pathsToSSHSecrets []strin
|
||||||
sshCmd = "ssh"
|
sshCmd = "ssh"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We can't pre-verify that key-files exist because we call this path
|
||||||
|
// without knowing whether we actually need SSH or not, in which case the
|
||||||
|
// files may not exist and that is OK. But we can make SSH report more.
|
||||||
|
switch {
|
||||||
|
case git.log.V(9).Enabled():
|
||||||
|
sshCmd += " -vvv"
|
||||||
|
case git.log.V(7).Enabled():
|
||||||
|
sshCmd += " -vv"
|
||||||
|
case git.log.V(5).Enabled():
|
||||||
|
sshCmd += " -v"
|
||||||
|
}
|
||||||
|
|
||||||
for _, p := range pathsToSSHSecrets {
|
for _, p := range pathsToSSHSecrets {
|
||||||
sshCmd += fmt.Sprintf(" -i %s", p)
|
sshCmd += fmt.Sprintf(" -i %s", p)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue