Skip to content

Commit 02f45fd

Browse files
committed
pkg/utils: Use newly introduced API for resolving default distro
#977
1 parent 8b6418d commit 02f45fd

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/pkg/utils/utils.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func GetContainerNamePrefixForImage(image string) (string, error) {
249249
}
250250

251251
func getDefaultImageForDistro(distro, release string) string {
252-
if _, supportedDistro := supportedDistros[distro]; !supportedDistro {
252+
if !IsDistroSupported(distro) {
253253
distro = "fedora"
254254
}
255255

@@ -643,13 +643,10 @@ func ShortID(id string) string {
643643
// 'general.distro' key in a config file or 'fedora') is assumed.
644644
func ParseRelease(distro, release string) (string, error) {
645645
if distro == "" {
646-
distro = distroDefault
647-
if viper.IsSet("general.distro") {
648-
distro = viper.GetString("general.distro")
649-
}
646+
distro, _ = ResolveDistro(distro)
650647
}
651648

652-
if _, supportedDistro := supportedDistros[distro]; !supportedDistro {
649+
if !IsDistroSupported(distro) {
653650
distro = "fedora"
654651
}
655652

@@ -796,10 +793,7 @@ func ResolveImageName(distroCLI, imageCLI, releaseCLI string) (string, string, e
796793
distro, image, release := distroCLI, imageCLI, releaseCLI
797794

798795
if distroCLI == "" {
799-
distro = distroDefault
800-
if viper.IsSet("general.distro") {
801-
distro = viper.GetString("general.distro")
802-
}
796+
distro, _ = ResolveDistro(distroCLI)
803797
}
804798

805799
if distro != distroDefault && releaseCLI == "" && !viper.IsSet("general.release") {

0 commit comments

Comments
 (0)