Skip to content

Commit

Permalink
OCPBUGS-36532: Agent installer wait-for, just test connectivity to host
Browse files Browse the repository at this point in the history
In the agent wait-for, when the APIs are not available, an attempt is
made to check the host by ssh'ing to it. This results in confusing
debug messages if the keys aren't present. This changes the check to
just test connectivity to the host.
  • Loading branch information
bfournie committed Oct 4, 2024
1 parent 04c1340 commit 7fa1ef5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/agent/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net"
"os"
"path/filepath"
"strconv"
"time"

"github.com/go-openapi/strfmt"
Expand All @@ -17,7 +16,6 @@ import (
"github.com/openshift/assisted-service/models"
"github.com/openshift/installer/pkg/asset/agent/gencrypto"
"github.com/openshift/installer/pkg/asset/agent/workflow"
"github.com/openshift/installer/pkg/gather/ssh"
)

// Cluster is a struct designed to help interact with the cluster that is
Expand Down Expand Up @@ -483,14 +481,16 @@ func (czero *Cluster) PrintInstallStatus(cluster *models.Cluster) {
}
}

// CanSSHToNodeZero Checks if ssh to NodeZero succeeds.
// CanSSHToNodeZero Checks if NodeZero is reachable.
func (czero *Cluster) CanSSHToNodeZero() bool {
ip := czero.API.Rest.NodeZeroIP
port := 22

_, err := ssh.NewClient("core", net.JoinHostPort(ip, strconv.Itoa(port)), czero.API.Rest.NodeSSHKey)
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", ip, port))
if err != nil {
logrus.Debugf("Failed to connect to the Rendezvous Host: %s", err)
} else {
conn.Close()
}
return err == nil
}
Expand Down

0 comments on commit 7fa1ef5

Please sign in to comment.