Skip to content

Commit

Permalink
Improve run and debug attach message upon failure
Browse files Browse the repository at this point in the history
Kubernetes-commit: 43c2ae479f056f9e420062e11f3251b7095c3108
  • Loading branch information
soltysh authored and k8s-publishing-bot committed Jun 24, 2022
1 parent 2d67b5a commit 6707e9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ func (o *DebugOptions) handleAttachPod(ctx context.Context, f cmdutil.Factory, n
}

if err := opts.Run(); err != nil {
fmt.Fprintf(opts.ErrOut, "Error attaching, falling back to logs: %v\n", err)
fmt.Fprintf(opts.ErrOut, "warning: couldn't attach to pod/%s, falling back to streaming logs: %v\n", podName, err)
return logOpts(f, pod, opts)
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func handleAttachPod(f cmdutil.Factory, podClient corev1client.PodsGetter, ns, n
}

if err := opts.Run(); err != nil {
fmt.Fprintf(opts.ErrOut, "Error attaching, falling back to logs: %v\n", err)
fmt.Fprintf(opts.ErrOut, "warning: couldn't attach to pod/%s, falling back to streaming logs: %v\n", name, err)
return logOpts(f, pod, opts)
}
return nil
Expand Down

0 comments on commit 6707e9d

Please sign in to comment.