From 5ad9bcf17a218db3b6a4b671ed84ecdc7004f875 Mon Sep 17 00:00:00 2001 From: juanvallejo Date: Mon, 31 Oct 2016 10:25:50 -0400 Subject: [PATCH] UPSTREAM: 34434: Print valid json/yaml output This patch updates `oc set image` to print the info `running in local mode...` through stderr in order to allow only json or yaml output when using the `--local` flag. --- vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set.go | 3 +-- vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set_image.go | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set.go index 249492769729..82ddb9290be2 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set.go @@ -32,7 +32,6 @@ var ( set_example = dedent.Dedent(``) ) - func NewCmdSet(f *cmdutil.Factory, out, err io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "set SUBCOMMAND", @@ -45,7 +44,7 @@ func NewCmdSet(f *cmdutil.Factory, out, err io.Writer) *cobra.Command { } // add subcommands - cmd.AddCommand(NewCmdImage(f, out)) + cmd.AddCommand(NewCmdImage(f, out, err)) cmd.AddCommand(NewCmdResources(f, out, err)) return cmd diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set_image.go b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set_image.go index e1515102f370..b73273c05c76 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set_image.go +++ b/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/set/set_image.go @@ -80,9 +80,10 @@ var ( kubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml`) ) -func NewCmdImage(f *cmdutil.Factory, out io.Writer) *cobra.Command { +func NewCmdImage(f *cmdutil.Factory, out, err io.Writer) *cobra.Command { options := &ImageOptions{ Out: out, + Err: err, } cmd := &cobra.Command{ @@ -210,7 +211,7 @@ func (o *ImageOptions) Run() error { } if o.Local { - fmt.Fprintln(o.Out, "running in local mode...") + fmt.Fprintln(o.Err, "running in local mode...") return o.PrintObject(o.Cmd, o.Mapper, info.Object, o.Out) }