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

@ -29,18 +29,12 @@ func init() {
}
for _, release := range releases {
container := fmt.Sprintf("out_of_tree_debian_%d", release)
distro.Register(Debian{
release: release,
container: container,
})
distro.Register(Debian{release: release})
}
}
type Debian struct {
release Release
container string
release Release
}
func (d Debian) Equal(dd distro.Distro) bool {
@ -56,7 +50,7 @@ func (d Debian) Distro() distro.Distro {
}
func (d Debian) Packages() (packages []string, err error) {
c, err := container.New(d.container)
c, err := container.New(d.Distro())
if err != nil {
return
}

View File

@ -46,8 +46,7 @@ func TestKernelRelease(t *testing.T) {
func TestDebian(t *testing.T) {
assert := assert.New(t)
u := Debian{release: Wheezy, container: "out_of_tree_debian_7"}
u := Debian{release: Wheezy}
assert.True(u.Equal(distro.Distro{Release: "wheezy", ID: distro.Debian}))