Skip to content

Commit

Permalink
Fix minikube flag parsing. (kubernetes#1418)
Browse files Browse the repository at this point in the history
We can't use flags in init like this. They're not parsed yet.
  • Loading branch information
dlorenc authored and dalehamel committed May 3, 2017
1 parent 3db346c commit 9477e67
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions cmd/minikube/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ var RootCmd = &cobra.Command{
Please use --v=3 to show libmachine logs, and --v=7 for debug level libmachine logs
`)
}

//TODO(r2d4): config should not reference API
clientType = configCmd.GetClientType()

logDir := pflag.Lookup("log_dir")
if !logDir.Changed {
logDir.Value.Set(constants.MakeMiniPath("logs"))
}

if enableUpdateNotification {
notify.MaybePrintUpdateTextFromGithub(os.Stderr)
}
util.MaybePrintKubectlDownloadMsg(runtime.GOOS, os.Stderr)
},
}

Expand Down Expand Up @@ -128,20 +141,10 @@ func init() {
RootCmd.AddCommand(configCmd.ConfigCmd)
RootCmd.AddCommand(configCmd.AddonsCmd)
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
logDir := pflag.Lookup("log_dir")
if !logDir.Changed {
logDir.Value.Set(constants.MakeMiniPath("logs"))
}
viper.BindPFlags(RootCmd.PersistentFlags())
cobra.OnInitialize(initConfig)

//TODO(r2d4): config should not reference API
clientType = configCmd.GetClientType()
cobra.OnInitialize(initConfig)

if enableUpdateNotification {
notify.MaybePrintUpdateTextFromGithub(os.Stderr)
}
util.MaybePrintKubectlDownloadMsg(runtime.GOOS, os.Stderr)
}

// initConfig reads in config file and ENV variables if set.
Expand Down

0 comments on commit 9477e67

Please sign in to comment.