Commit 882f838a authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #49134 from deads2k/cli-14-tolerate-missing-template

Automatic merge from submit-queue (batch tested with PRs 49055, 49128, 49132, 49134, 49110) make sure that the template param is the right type before using it The CLI should attempt to make sure that the flags it uses conform to expectations instead of unconditionally killing a process. This allows for possible re-use of the printing stack.
parents 8337bd02 a67255c1
......@@ -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"
......
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