Skip to content

Commit

Permalink
pkg/utils: Use newly introduced API for resolving default distro
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryMichal committed Feb 21, 2022
1 parent 8b6418d commit 02f45fd
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down Expand Up @@ -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"
}

Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 02f45fd

Please sign in to comment.