only read ssh_config for non machine connections

For machine we know we have all the info we need so there is no reason
to read and parse another file.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2024-11-14 16:56:24 +01:00
parent cbb2820a7e
commit 71f1f52894
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 56 additions and 51 deletions

View File

@ -162,7 +162,11 @@ func sshClient(_url *url.URL, uri string, identity string, machine bool) (Connec
return connection, err
}
}
// ssh_config
// only parse ssh_config when we are not connecting to a machine
// For machine connections we always have the full URL in the
// system connection so reading the file is just unnecessary.
if !machine {
alias := _url.Hostname()
cfg := ssh_config.DefaultUserSettings
cfg.IgnoreErrors = true
@ -225,6 +229,7 @@ func sshClient(_url *url.URL, uri string, identity string, machine bool) (Connec
logrus.Debugf(" Port: %d", port)
logrus.Debugf(" IdentityFile: %q", identity)
}
}
conn, err := ssh.Dial(&ssh.ConnectionDialOptions{
Host: uri,
Identity: identity,