Refactor kubectl/cmd/config/getConfigFromFileOrDie

pull/6/head
Tamer Tas 2015-04-06 22:38:40 +03:00
parent 8a7a127352
commit 6d84838c0f
1 changed files with 1 additions and 2 deletions

View File

@ -122,14 +122,13 @@ func (o *pathOptions) getStartingConfig() (*clientcmdapi.Config, string, error)
// getConfigFromFileOrDie tries to read a kubeconfig file and if it can't, it calls exit. One exception, missing files result in empty configs, not an exit
func getConfigFromFileOrDie(filename string) *clientcmdapi.Config {
var err error
config, err := clientcmd.LoadFromFile(filename)
if err != nil && !os.IsNotExist(err) {
glog.FatalDepth(1, err)
}
if config == nil {
config = clientcmdapi.NewConfig()
return clientcmdapi.NewConfig()
}
return config