Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/openshift-install/gather: Recognize "connection refused" #2810

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cmd/openshift-install/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
"time"

configv1 "github.com/openshift/api/config/v1"
Expand Down Expand Up @@ -117,11 +118,15 @@ func runGatherBootstrapCmd(directory string) error {
func logGatherBootstrap(bootstrap string, port int, masters []string, directory string) error {
logrus.Info("Pulling debug logs from the bootstrap machine")
client, err := ssh.NewClient("core", fmt.Sprintf("%s:%d", bootstrap, port), gatherBootstrapOpts.sshKeys)
if err != nil && len(gatherBootstrapOpts.sshKeys) == 0 {
return errors.Wrap(err, "failed to create SSH client, ensure the proper ssh key is in your keyring or specify with --key")
} else if err != nil {
if err != nil {
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ECONNREFUSED {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. shouldn't see https://golang.org/pkg/net/#OpError ? and the OpError.Err contains the syscall error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just wait for Go 1.13 and the Unwrap business.

return errors.Wrap(err, "failed to connect to the bootstrap machine")
} else if len(gatherBootstrapOpts.sshKeys) == 0 {
return errors.Wrap(err, "failed to create SSH client, ensure the proper ssh key is in your keyring or specify with --key")
}
return errors.Wrap(err, "failed to create SSH client")
}

gatherID := time.Now().Format("20060102150405")
if err := ssh.Run(client, fmt.Sprintf("/usr/local/bin/installer-gather.sh --id %s %s", gatherID, strings.Join(masters, " "))); err != nil {
return errors.Wrap(err, "failed to run remote command")
Expand Down