From a155111acdc9151e0ce6f1cf9379ca886c90638b Mon Sep 17 00:00:00 2001 From: Janet Kuo Date: Fri, 27 Jan 2017 11:13:51 -0800 Subject: [PATCH] Print resource name when patch is done --- pkg/kubectl/cmd/patch.go | 2 +- pkg/kubectl/cmd/patch_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/kubectl/cmd/patch.go b/pkg/kubectl/cmd/patch.go index 3e0f55342fa..cdf913651c1 100644 --- a/pkg/kubectl/cmd/patch.go +++ b/pkg/kubectl/cmd/patch.go @@ -209,7 +209,7 @@ func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin } if options.OutputFormat == "name" || len(options.OutputFormat) == 0 { - cmdutil.PrintSuccess(mapper, options.OutputFormat == "name", out, "", name, false, dataChangedMsg) + cmdutil.PrintSuccess(mapper, options.OutputFormat == "name", out, info.Mapping.Resource, info.Name, false, dataChangedMsg) } return nil } diff --git a/pkg/kubectl/cmd/patch_test.go b/pkg/kubectl/cmd/patch_test.go index 401a6429905..e3c34bee13b 100644 --- a/pkg/kubectl/cmd/patch_test.go +++ b/pkg/kubectl/cmd/patch_test.go @@ -54,7 +54,7 @@ func TestPatchObject(t *testing.T) { cmd.Run(cmd, []string{"services/frontend"}) // uses the name from the file, not the response - if buf.String() != "frontend\n" { + if buf.String() != "service/frontend\n" { t.Errorf("unexpected output: %s", buf.String()) } } @@ -88,7 +88,7 @@ func TestPatchObjectFromFile(t *testing.T) { cmd.Run(cmd, []string{}) // uses the name from the file, not the response - if buf.String() != "frontend\n" { + if buf.String() != "service/frontend\n" { t.Errorf("unexpected output: %s", buf.String()) } }