From 8801fe902ab729aadb6f670435e11ef3d4414f04 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Fri, 22 Sep 2023 07:42:29 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Handle=20ssh=20connection=20erro?= =?UTF-8?q?rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #1812 Fixes #1814 Signed-off-by: Christian Zunker --- providers/os/provider/provider.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/providers/os/provider/provider.go b/providers/os/provider/provider.go index 66d7324ef8..ea982abd78 100644 --- a/providers/os/provider/provider.go +++ b/providers/os/provider/provider.go @@ -300,6 +300,9 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba case SshConnectionType: s.lastConnectionID++ conn, err = connection.NewSshConnection(s.lastConnectionID, conf, asset) + if err != nil { + return nil, err + } fingerprint, err := IdentifyPlatform(conn, asset.Platform, []string{ids.IdDetector_Hostname, ids.IdDetector_CloudDetect, ids.IdDetector_SshHostkey}) if err == nil { if conn.Asset().Connections[0].Runtime != "vagrant" { @@ -311,6 +314,9 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba case TarConnectionType: s.lastConnectionID++ conn, err = connection.NewTarConnection(s.lastConnectionID, conf, asset) + if err != nil { + return nil, err + } fingerprint, err := IdentifyPlatform(conn, asset.Platform, []string{ids.IdDetector_Hostname}) if err == nil { asset.Name = fingerprint.Name @@ -320,6 +326,9 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba case DockerSnapshotConnectionType: s.lastConnectionID++ conn, err = connection.NewDockerSnapshotConnection(s.lastConnectionID, conf, asset) + if err != nil { + return nil, err + } fingerprint, err := IdentifyPlatform(conn, asset.Platform, []string{ids.IdDetector_Hostname}) if err == nil { asset.Name = fingerprint.Name @@ -358,6 +367,9 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba case FilesystemConnectionType: s.lastConnectionID++ conn, err = connection.NewFileSystemConnection(s.lastConnectionID, conf, asset) + if err != nil { + return nil, err + } fingerprint, err := IdentifyPlatform(conn, asset.Platform, []string{ids.IdDetector_Hostname}) if err == nil { asset.Name = fingerprint.Name