Skip to content

Commit

Permalink
chore: improve log in case qovery admin k9s failed
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 committed Nov 6, 2024
1 parent 01f1644 commit 0aff32b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/admin_k9s.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ 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)
// continue anyway
}
defer cleanupSSHConnection(sshCmd)
Expand Down Expand Up @@ -130,15 +130,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 +147,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 0aff32b

Please sign in to comment.