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

chore: improve log in case qovery admin k9s failed #382

Merged
merged 1 commit into from
Nov 6, 2024
Merged
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
9 changes: 5 additions & 4 deletions cmd/admin_k9s.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ func launchK9s(args []string) {

sshCmd, err := setupSSHConnection(ctx)
if err != nil {
log.Errorf("Failed to kill SSH process: %v", err)
log.Errorf("Failed to setup SSH connection: %v", err)
log.Warnf("Connection failure might be due to issues with your SSH configuration. Consider checking and updating your ~/.ssh/known_hosts file to ensure the host is trusted.")
// continue anyway
}
defer cleanupSSHConnection(sshCmd)
Expand Down Expand Up @@ -130,15 +131,15 @@ func setupSSHConnection(ctx context.Context) (*exec.Cmd, error) {

sshCmd := exec.CommandContext(ctx, "ssh", sshArgs...)
if err := sshCmd.Start(); err != nil {
return nil, fmt.Errorf("error starting SSH command: %w", err)
return nil, fmt.Errorf("error starting SSH command: %v", err)
}

if err := waitForSSHConnection(ctx, "localhost:1080", 30*time.Second); err != nil {
err := sshCmd.Process.Kill()
if err != nil {
return nil, err
}
return nil, fmt.Errorf("error waiting for SSH connection: %w", err)
return nil, fmt.Errorf("error waiting for SSH connection: %v", err)
}

log.Info("SSH connection established successfully")
Expand All @@ -147,7 +148,7 @@ func setupSSHConnection(ctx context.Context) (*exec.Cmd, error) {
if err != nil {
return nil, err
}
return nil, fmt.Errorf("failed to set HTTPS_PROXY: %w", err)
return nil, fmt.Errorf("failed to set HTTPS_PROXY: %v", err)
}

return sshCmd, nil
Expand Down
Loading