Commit a67255c1 authored by deads2k's avatar deads2k

make sure that the template param is the right type before using it

parent 6b78eeca
...@@ -160,8 +160,10 @@ func extractOutputOptions(cmd *cobra.Command) *printers.OutputOptions { ...@@ -160,8 +160,10 @@ func extractOutputOptions(cmd *cobra.Command) *printers.OutputOptions {
// templates are logically optional for specifying a format. // 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 // TODO once https://github.com/kubernetes/kubernetes/issues/12668 is fixed, this should fall back to GetFlagString
var templateFile string var templateFile string
if flags.Lookup("template") != nil { if flag := flags.Lookup("template"); flag != nil {
templateFile = GetFlagString(cmd, "template") if flag.Value.Type() == "string" {
templateFile = GetFlagString(cmd, "template")
}
} }
if len(outputFormat) == 0 && len(templateFile) != 0 { if len(outputFormat) == 0 && len(templateFile) != 0 {
outputFormat = "template" outputFormat = "template"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment