Control: tag -1 patch
Reinhard Tartler <[email protected]> writes:
> It seems that your package FTBFS with docker 27.5.1 [...]
>
> 73s # github.com/crowdsecurity/crowdsec/pkg/metabase
> 73s src/github.com/crowdsecurity/crowdsec/pkg/metabase/container.go:49:53:
> undefined: types.ImagePullOptions
> 73s src/github.com/crowdsecurity/crowdsec/pkg/metabase/container.go:171:57:
> undefined: types.ImageRemoveOptions
Cyril, I was having trouble building the package from the git branch on
salsa, somehow the patches didn't apply. I was, however, able to
reproduce that error and was able to come up with a code change that
allows crowdsec to compile against docker 27, which is now in
unstable. Please review and upload the below patch to unstable at your
earliest convenience, as this bug is currently RC. Thanks!
-rt
diff --git a/pkg/metabase/container.go b/pkg/metabase/container.go
index 2368a9b..131a5c9 100644
--- a/pkg/metabase/container.go
+++ b/pkg/metabase/container.go
@@ -6,7 +6,7 @@ import (
"fmt"
"runtime"
- "github.com/docker/docker/api/types"
+ "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/client"
@@ -46,7 +46,7 @@ func NewContainer(listenAddr string, listenPort string,
sharedFolder string, con
func (c *Container) Create() error {
ctx := context.Background()
log.Printf("Pulling docker image %s", c.Image)
- reader, err := c.CLI.ImagePull(ctx, c.Image, types.ImagePullOptions{})
+ reader, err := c.CLI.ImagePull(ctx, c.Image, image.PullOptions{})
if err != nil {
return fmt.Errorf("failed to pull docker image : %s", err)
}
@@ -168,7 +168,7 @@ func RemoveImageContainer() error {
}
ctx := context.Background()
log.Printf("Removing docker image '%s'", metabaseImage)
- if _, err := cli.ImageRemove(ctx, metabaseImage,
types.ImageRemoveOptions{}); err != nil {
+ if _, err := cli.ImageRemove(ctx, metabaseImage,
image.RemoveOptions{}); err != nil {
return fmt.Errorf("failed to remove image container %s : %s",
metabaseImage, err)
}
return nil