cloudapi: Use distro repos if none included in imageRequest

In order to support cloudapi blueprint requests from the cmdline using
composer-cli it needs to select the repositories based on the selected
distribution instead of requiring the user to include them with the
request.

If the image request includes repositories they are used, which matches
the current behavior. If the repository list is empty it will use the
distribution name to select from the repositories shipped with
osbuild-composer.
This commit is contained in:
Brian C. Lane 2024-02-02 17:17:49 -08:00 committed by Brian C. Lane
parent 01ba674cac
commit 57ebfb4011
4 changed files with 49 additions and 12 deletions

View file

@ -4,7 +4,6 @@ package v2
import (
"encoding/json"
"fmt"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"net/http"
"os"
"strconv"
@ -17,6 +16,7 @@ import (
"github.com/osbuild/images/pkg/manifest"
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/target"
"github.com/osbuild/osbuild-composer/internal/worker"
@ -153,7 +153,7 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
return HTTPErrorWithInternal(ErrorTenantNotFound, err)
}
irs, err := request.GetImageRequests(h.server.distros)
irs, err := request.GetImageRequests(h.server.distros, h.server.repos)
if err != nil {
return err
}