From e1936d57f8a5fdd205557fbe7b78f8fc7c26ee5a Mon Sep 17 00:00:00 2001 From: Jeff Lowdermilk Date: Fri, 22 May 2015 09:44:00 -0700 Subject: [PATCH] Make rolling-update actually parse filenames from stdin --- pkg/kubectl/cmd/rollingupdate.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/kubectl/cmd/rollingupdate.go b/pkg/kubectl/cmd/rollingupdate.go index ed55e41d723..e15166c78da 100644 --- a/pkg/kubectl/cmd/rollingupdate.go +++ b/pkg/kubectl/cmd/rollingupdate.go @@ -161,6 +161,14 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg return err } var ok bool + // Handle filename input from stdin. The resource builder always returns an api.List + // when creating resource(s) from a stream. + if list, ok := obj.(*api.List); ok { + if len(list.Items) > 1 { + return cmdutil.UsageError(cmd, "%s specifies multiple items", filename) + } + obj = list.Items[0] + } newRc, ok = obj.(*api.ReplicationController) if !ok { if _, kind, err := typer.ObjectVersionAndKind(obj); err == nil {