From 7e07289cefab9fd338cdfc4328a6f52084c67eb7 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Tue, 31 Mar 2020 16:55:29 +0100 Subject: [PATCH] runtimes/podman: just force remove containers on error --- runtimes/podman/podman.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/runtimes/podman/podman.go b/runtimes/podman/podman.go index 0b700c6..c864065 100644 --- a/runtimes/podman/podman.go +++ b/runtimes/podman/podman.go @@ -84,7 +84,7 @@ func (r *Runtime) StartContainer(ctx context.Context, conf *podrick.ContainerCon return nil, fmt.Errorf("failed to create container: %w", err) } ctr.close = func(ctx context.Context) error { - _, rErr := podman.RemoveContainer().Call(ctx, r.conn, ctr.id, false, true) + _, rErr := podman.RemoveContainer().Call(ctx, r.conn, ctr.id, true, true) if rErr != nil { return fmt.Errorf("failed to remove container: %w", rErr) } @@ -112,14 +112,6 @@ func (r *Runtime) StartContainer(ctx context.Context, conf *podrick.ContainerCon if err != nil { return nil, fmt.Errorf("failed to start container: %w", err) } - cls2 := ctr.close - ctr.close = func(ctx context.Context) error { - _, kErr := podman.StopContainer().Call(ctx, r.conn, ctr.id, 5) - if kErr != nil { - return fmt.Errorf("failed to stop container: %w", kErr) - } - return cls2(ctx) - } ct, err := podman.GetContainer().Call(ctx, r.conn, ctr.id) if err != nil {