From 4646b2232845d9ae62da425006f4baba476e048d Mon Sep 17 00:00:00 2001 From: Ian Howell Date: Wed, 24 Jul 2019 16:38:45 -0500 Subject: [PATCH] Fix a parsing issue with command line arguments Prior to now, helm has been silently ignoring any errors while parsing the root Persistent flags. This causes an issue when a global flag comes later on the command line than a localized flag for a subcommand, in which the value for that global flag is never set. The solution is to simply tell the Persistent flagset to ignore any unknown flags, since a later command will process it Signed-off-by: Ian Howell --- cmd/helm/root.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/helm/root.go b/cmd/helm/root.go index 18fc884bf..41d067b99 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -119,6 +119,11 @@ func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string settings.AddFlags(flags) + // We can safely ignore any errors that flags.Parse encounters since + // those errors will be caught later during the call to cmd.Execution. + // This call is required to gather configuration information prior to + // execution. + flags.ParseErrorsWhitelist.UnknownFlags = true flags.Parse(args) // set defaults from environment