Merge pull request #40618 from janetkuo/patch-resource-name

Automatic merge from submit-queue (batch tested with PRs 40703, 40093, 40618, 40659, 39810)

Print resource name when patch is done

Before:
```console
$ kubectl patch deployment nginx -p '{"spec":{"progressDeadlineSeconds":200}}'
"nginx" patched
```

After:
```console
$ kubectl patch deployment nginx -p '{"spec":{"progressDeadlineSeconds":200}}'
deployment "nginx" patched
```
This commit is contained in:
Kubernetes Submit Queue
2017-01-30 17:14:54 -08:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -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
}

View File

@@ -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())
}
}