From 969d526ca5123325930a5dbf1f4cac0478bf4d08 Mon Sep 17 00:00:00 2001 From: deads2k Date: Thu, 13 Aug 2015 13:11:00 -0400 Subject: [PATCH] tolerate output without template file --- pkg/kubectl/cmd/util/printing.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/kubectl/cmd/util/printing.go b/pkg/kubectl/cmd/util/printing.go index 6d70c1bdbfc..251e4ae3a7b 100644 --- a/pkg/kubectl/cmd/util/printing.go +++ b/pkg/kubectl/cmd/util/printing.go @@ -82,7 +82,10 @@ func OutputVersion(cmd *cobra.Command, defaultVersion string) string { // Requires that printer flags have been added to cmd (see AddPrinterFlags). func PrinterForCommand(cmd *cobra.Command) (kubectl.ResourcePrinter, bool, error) { outputFormat := GetFlagString(cmd, "output") - templateFile := GetFlagString(cmd, "template") + + // 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 + templateFile, _ := cmd.Flags().GetString("template") if len(outputFormat) == 0 && len(templateFile) != 0 { outputFormat = "template" }