From e73c22a12a03823160861685a04a086967324142 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Thu, 5 Jan 2023 00:17:27 +0200 Subject: [PATCH] Fix profile list when profiles directory is missing This was reported in [1] and fixed in [2] in 2019, but later it was broken by [3] in commit c3aafaeeb4541b0cd5303afe211fe281dbf5e4f3. `listProfiles()` can return `os.ErrNotExist` from `os.ReadDir()` so it must be tested with `os.IsNotExist()`. [1] https://github.com/kubernetes/minikube/issues/5898 [2] https://github.com/kubernetes/minikube/pull/5955 [3] https://github.com/kubernetes/minikube/pull/6440 --- cmd/minikube/cmd/config/profile_list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/config/profile_list.go b/cmd/minikube/cmd/config/profile_list.go index 2cd2f1432f6e..7bac189c54c6 100644 --- a/cmd/minikube/cmd/config/profile_list.go +++ b/cmd/minikube/cmd/config/profile_list.go @@ -205,7 +205,7 @@ func printProfilesJSON() { updateProfilesStatus(validProfiles) var body = map[string]interface{}{} - if err == nil || config.IsNotExist(err) { + if err == nil || os.IsNotExist(err) { body["valid"] = profilesOrDefault(validProfiles) body["invalid"] = profilesOrDefault(invalidProfiles) jsonString, _ := json.Marshal(body)