distro: drop NewDefaultRegistry()

Require the caller to pass in the required distros explicitly. This
would allow us to easily add distros in osbuild-pipeline and tests
before exposing them in composer itself, for instance.

This means there is no longer a dependency from the distro package
to each of the individual distros, so the distros are now able
to depend on the distro packag for types and interfaces.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-22 13:02:29 +01:00 committed by msehnout
parent 08ff8ab81b
commit ff0ec01eb6
4 changed files with 21 additions and 16 deletions

View file

@ -14,12 +14,6 @@ import (
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/distro/fedora30"
"github.com/osbuild/osbuild-composer/internal/distro/fedora31"
"github.com/osbuild/osbuild-composer/internal/distro/fedora32"
"github.com/osbuild/osbuild-composer/internal/distro/rhel81"
"github.com/osbuild/osbuild-composer/internal/distro/rhel82"
)
type Distro interface {
@ -78,11 +72,6 @@ func NewRegistry(distros ...Distro) (*Registry, error) {
return reg, nil
}
// NewDefaultRegistry creates a new Registry containing all known distros.
func NewDefaultRegistry() (*Registry, error) {
return NewRegistry(fedora30.New(), fedora31.New(), fedora32.New(), rhel81.New(), rhel82.New())
}
func (r *Registry) GetDistro(name string) Distro {
distroTag, exists := common.DistributionFromString(name)
if !exists {