mirror of
https://github.com/docker/docs.git
synced 2026-03-27 14:28:47 +07:00
Adds check for SSH keygen command
Adds a check to find ssh-keygen in the user's $PATH, in the event it can't find it, return an error with a friendly message Signed-off-by: Simon Thulbourn <simon+github@thulbourn.com>
This commit is contained in:
@@ -36,6 +36,10 @@ func GetSSHCommand(host string, port int, user string, sshKey string, args ...st
|
||||
}
|
||||
|
||||
func GenerateSSHKey(path string) error {
|
||||
if _, err := exec.LookPath("ssh-keygen"); err != nil {
|
||||
return fmt.Errorf("ssh-keygen not found in the path, please install ssh-keygen")
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user