From a67255c170fa23b87267bb9644ed10d38d13baec Mon Sep 17 00:00:00 2001 From: deads2k Date: Tue, 18 Jul 2017 13:48:29 -0400 Subject: [PATCH] make sure that the template param is the right type before using it --- pkg/kubectl/cmd/util/printing.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kubectl/cmd/util/printing.go b/pkg/kubectl/cmd/util/printing.go index b1e9b3527d5..4aee9ebc0e9 100644 --- a/pkg/kubectl/cmd/util/printing.go +++ b/pkg/kubectl/cmd/util/printing.go @@ -160,8 +160,10 @@ func extractOutputOptions(cmd *cobra.Command) *printers.OutputOptions { // templates are logically optional for specifying a format. // TODO once https://github.com/kubernetes/kubernetes/issues/12668 is fixed, this should fall back to GetFlagString var templateFile string - if flags.Lookup("template") != nil { - templateFile = GetFlagString(cmd, "template") + if flag := flags.Lookup("template"); flag != nil { + if flag.Value.Type() == "string" { + templateFile = GetFlagString(cmd, "template") + } } if len(outputFormat) == 0 && len(templateFile) != 0 { outputFormat = "template"