1
0

feat: use distro info to create the container

This commit is contained in:
2023-05-23 16:54:34 +00:00
parent f2ce20e53b
commit 7ca989fd8d
12 changed files with 130 additions and 150 deletions

View File

@ -20,19 +20,12 @@ func init() {
}
for _, release := range releases {
container := "out_of_tree_ubuntu_" + release
container = strings.Replace(container, ".", "__", -1)
distro.Register(Ubuntu{
release: release,
container: container,
})
distro.Register(Ubuntu{release: release})
}
}
type Ubuntu struct {
release string
container string
release string
}
func (u Ubuntu) Equal(d distro.Distro) bool {
@ -44,7 +37,7 @@ func (u Ubuntu) Distro() distro.Distro {
}
func (u Ubuntu) Packages() (pkgs []string, err error) {
c, err := container.New(u.container)
c, err := container.New(u.Distro())
if err != nil {
return
}

View File

@ -11,7 +11,7 @@ import (
func TestUbuntu(t *testing.T) {
assert := assert.New(t)
u := Ubuntu{release: "22.04", container: "out_of_tree_ubuntu_22__04"}
u := Ubuntu{release: "22.04"}
assert.True(u.Equal(distro.Distro{Release: "22.04", ID: distro.Ubuntu}))