Skip to content

Commit

Permalink
Merge pull request #110764 from soltysh/improve_msg
Browse files Browse the repository at this point in the history
Improve run and debug attach message upon failure
  • Loading branch information
k8s-ci-robot committed Jun 24, 2022
2 parents e526241 + 43c2ae4 commit 411ecc3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion staging/src/k8s.io/kubectl/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 staging/src/k8s.io/kubectl/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 411ecc3

Please sign in to comment.