From 02f45fd3f2d5b545695fa7fa0cdf600ab9ba8a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20M=C3=ADchal?= Date: Sun, 9 Jan 2022 16:49:28 +0200 Subject: [PATCH] pkg/utils: Use newly introduced API for resolving default distro https://github.com/containers/toolbox/pull/977 --- src/pkg/utils/utils.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/pkg/utils/utils.go b/src/pkg/utils/utils.go index c7ca233..61570d8 100644 --- a/src/pkg/utils/utils.go +++ b/src/pkg/utils/utils.go @@ -249,7 +249,7 @@ func GetContainerNamePrefixForImage(image string) (string, error) { } func getDefaultImageForDistro(distro, release string) string { - if _, supportedDistro := supportedDistros[distro]; !supportedDistro { + if !IsDistroSupported(distro) { distro = "fedora" } @@ -643,13 +643,10 @@ func ShortID(id string) string { // 'general.distro' key in a config file or 'fedora') is assumed. func ParseRelease(distro, release string) (string, error) { if distro == "" { - distro = distroDefault - if viper.IsSet("general.distro") { - distro = viper.GetString("general.distro") - } + distro, _ = ResolveDistro(distro) } - if _, supportedDistro := supportedDistros[distro]; !supportedDistro { + if !IsDistroSupported(distro) { distro = "fedora" } @@ -796,10 +793,7 @@ func ResolveImageName(distroCLI, imageCLI, releaseCLI string) (string, string, e distro, image, release := distroCLI, imageCLI, releaseCLI if distroCLI == "" { - distro = distroDefault - if viper.IsSet("general.distro") { - distro = viper.GetString("general.distro") - } + distro, _ = ResolveDistro(distroCLI) } if distro != distroDefault && releaseCLI == "" && !viper.IsSet("general.release") {