From 24fbba393e58c0c06e3b6f00086e758030570816 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Thu, 8 Dec 2016 17:40:08 -0800 Subject: [PATCH] Remove "pod xxx deleted" message from kubectl run --rm Its unnecessary to print the message when the user asked for it. We should only show a msg (error) when we didn't do what they asked. Also showing this in a "kubectl run" is bad because it then gets appended to the user's output and they would then have to strip it off if they want to use the output in some follow-on processing. Signed-off-by: Doug Davis --- pkg/kubectl/cmd/run.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/kubectl/cmd/run.go b/pkg/kubectl/cmd/run.go index 1d772d73be2..349e112c97a 100644 --- a/pkg/kubectl/cmd/run.go +++ b/pkg/kubectl/cmd/run.go @@ -326,7 +326,13 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr ResourceNames(mapping.Resource, name). Flatten(). Do() - err = ReapResult(r, f, cmdOut, true, true, 0, -1, false, false, mapper, quiet) + // Note: we pass in "true" for the "quiet" parameter because + // ReadResult will only print one thing based on the "quiet" + // flag, and that's the "pod xxx deleted" message. If they + // asked for us to remove the pod (via --rm) then telling them + // its been deleted is unnecessary since that's what they asked + // for. We should only print something if the "rm" fails. + err = ReapResult(r, f, cmdOut, true, true, 0, -1, false, false, mapper, true) if err != nil { return err }