distro: don't fall back to fedora-30

Make osbuild-composer use FromHost() directly. Everywhere else needs to
specify the distro explicitly.

Also don't panic when a distro doesn't exist. Instead, return nil. Make
sure all callers check for that.
This commit is contained in:
Lars Karlitski 2019-11-28 19:49:45 +01:00
parent 70857963bb
commit 85e6182bdc
7 changed files with 34 additions and 33 deletions

View file

@ -5,6 +5,7 @@ import (
"testing"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/jobqueue"
"github.com/osbuild/osbuild-composer/internal/store"
"github.com/osbuild/osbuild-composer/internal/test"
@ -31,7 +32,7 @@ func TestBasic(t *testing.T) {
}
for _, c := range cases {
api := jobqueue.New(nil, store.New(nil))
api := jobqueue.New(nil, store.New(nil, distro.New("fedora-30")))
test.TestRoute(t, api, false, c.Method, c.Path, c.Body, c.ExpectedStatus, c.ExpectedJSON)
}
@ -39,7 +40,7 @@ func TestBasic(t *testing.T) {
func TestCreate(t *testing.T) {
id, _ := uuid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff")
store := store.New(nil)
store := store.New(nil, distro.New("fedora-30"))
api := jobqueue.New(nil, store)
err := store.PushCompose(id, &blueprint.Blueprint{}, "tar")
@ -53,7 +54,7 @@ func TestCreate(t *testing.T) {
func testUpdateTransition(t *testing.T, from, to string, expectedStatus int) {
id, _ := uuid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff")
store := store.New(nil)
store := store.New(nil, distro.New("fedora-30"))
api := jobqueue.New(nil, store)
if from != "VOID" {