Skip to content

Commit

Permalink
Fix profile list when profiles directory is missing
Browse files Browse the repository at this point in the history
This was reported in [1] and fixed in [2] in 2019, but later it was
broken by [3] in commit c3aafae.

`listProfiles()` can return `os.ErrNotExist` from `os.ReadDir()` so it
must be tested with `os.IsNotExist()`.

[1] kubernetes#5898
[2] kubernetes#5955
[3] kubernetes#6440
  • Loading branch information
nirs committed Jan 4, 2023
1 parent afe0f18 commit e73c22a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/profile_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e73c22a

Please sign in to comment.