mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
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.
This commit is contained in:
commit
882f838a0d
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user