From e4f062b006958382af8e2251e5c908685f485217 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 30 Oct 2024 16:04:01 -0400 Subject: [PATCH] engine: resources: Parse distro properly I regressed here when patching this. Here's the fix. Would be beautiful to have hardware to run end-to-end testing on. If you want to sponsor this, please let me know! --- engine/resources/virt_builder.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/resources/virt_builder.go b/engine/resources/virt_builder.go index ec6cb726..dc081613 100644 --- a/engine/resources/virt_builder.go +++ b/engine/resources/virt_builder.go @@ -219,7 +219,12 @@ func (obj *VirtBuilderRes) getGuestfs() ([]string, error) { // that we can easily run mgmt. func (obj *VirtBuilderRes) getDeps() ([]string, error) { // TODO: Improve this function as things evolve. - distro := strings.TrimSuffix(obj.OSVersion, "-") // fedora- or debian- + ix := strings.Index(obj.OSVersion, "-") // fedora- or debian- + if ix == -1 { + return nil, fmt.Errorf("os version is not supported") + } + + distro := obj.OSVersion[0:ix] // everything before the dash, eg: fedora packages, exists := distroUtil.ToBootstrapPackages(distro) if !exists { // TODO: patches welcome!