Skip to content

Commit

Permalink
chore: improve log in case qovery admin k9s failed (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 authored Nov 6, 2024
1 parent 01f1644 commit 729728e
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit 729728e

Please sign in to comment.