mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
make sure that the template param is the right type before using it
This commit is contained in:
parent
6b78eeca84
commit
a67255c170
@ -160,9 +160,11 @@ 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 {
|
||||||
|
if flag.Value.Type() == "string" {
|
||||||
templateFile = GetFlagString(cmd, "template")
|
templateFile = GetFlagString(cmd, "template")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if len(outputFormat) == 0 && len(templateFile) != 0 {
|
if len(outputFormat) == 0 && len(templateFile) != 0 {
|
||||||
outputFormat = "template"
|
outputFormat = "template"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user