Skip to content

Commit

Permalink
runtimes/podman: just force remove containers on error
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Mar 31, 2020
1 parent 68f4ebd commit 7e07289
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions runtimes/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7e07289

Please sign in to comment.