summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/containers.go11
-rw-r--r--pkg/domain/infra/abi/containers_runlabel.go3
-rw-r--r--pkg/domain/infra/abi/network.go4
-rw-r--r--pkg/domain/infra/abi/pods.go2
-rw-r--r--pkg/domain/infra/abi/volumes.go2
-rw-r--r--pkg/domain/infra/tunnel/containers.go4
-rw-r--r--pkg/domain/infra/tunnel/network.go3
-rw-r--r--pkg/domain/infra/tunnel/pods.go3
-rw-r--r--pkg/domain/infra/tunnel/volumes.go3
9 files changed, 25 insertions, 10 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 8e7e2d411..6ca142618 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -283,7 +283,7 @@ func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []st
}
func (ic *ContainerEngine) removeContainer(ctx context.Context, ctr *libpod.Container, options entities.RmOptions) error {
- err := ic.Libpod.RemoveContainer(ctx, ctr, options.Force, options.Volumes)
+ err := ic.Libpod.RemoveContainer(ctx, ctr, options.Force, options.Volumes, options.Timeout)
if err == nil {
return nil
}
@@ -963,7 +963,8 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
return &report, nil
}
if opts.Rm {
- if deleteError := ic.Libpod.RemoveContainer(ctx, ctr, true, false); deleteError != nil {
+ var timeout *uint
+ if deleteError := ic.Libpod.RemoveContainer(ctx, ctr, true, false, timeout); deleteError != nil {
logrus.Debugf("unable to remove container %s after failing to start and attach to it", ctr.ID())
}
}
@@ -977,7 +978,8 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
}
report.ExitCode = ic.GetContainerExitCode(ctx, ctr)
if opts.Rm && !ctr.ShouldRestart(ctx) {
- if err := ic.Libpod.RemoveContainer(ctx, ctr, false, true); err != nil {
+ var timeout *uint
+ if err := ic.Libpod.RemoveContainer(ctx, ctr, false, true, timeout); err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr ||
errors.Cause(err) == define.ErrCtrRemoved {
logrus.Infof("Container %s was already removed, skipping --rm", ctr.ID())
@@ -1082,7 +1084,8 @@ func (ic *ContainerEngine) ContainerCleanup(ctx context.Context, namesOrIds []st
}
if options.Remove && !ctr.ShouldRestart(ctx) {
- err = ic.Libpod.RemoveContainer(ctx, ctr, false, true)
+ var timeout *uint
+ err = ic.Libpod.RemoveContainer(ctx, ctr, false, true, timeout)
if err != nil {
report.RmErr = errors.Wrapf(err, "failed to cleanup and remove container %v", ctr.ID())
}
diff --git a/pkg/domain/infra/abi/containers_runlabel.go b/pkg/domain/infra/abi/containers_runlabel.go
index add82f0fb..b0aae4b76 100644
--- a/pkg/domain/infra/abi/containers_runlabel.go
+++ b/pkg/domain/infra/abi/containers_runlabel.go
@@ -92,7 +92,8 @@ func (ic *ContainerEngine) ContainerRunlabel(ctx context.Context, label string,
}
} else {
logrus.Debugf("Runlabel --replace option given. Container %s will be deleted. The new container will be named %s", ctr.ID(), name)
- if err := ic.Libpod.RemoveContainer(ctx, ctr, true, false); err != nil {
+ var timeout *uint
+ if err := ic.Libpod.RemoveContainer(ctx, ctr, true, false, timeout); err != nil {
return err
}
}
diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go
index d792226a8..ee7403ed5 100644
--- a/pkg/domain/infra/abi/network.go
+++ b/pkg/domain/infra/abi/network.go
@@ -91,10 +91,10 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o
if err != nil {
return reports, err
}
- if err := ic.Libpod.RemovePod(ctx, pod, true, true); err != nil {
+ if err := ic.Libpod.RemovePod(ctx, pod, true, true, options.Timeout); err != nil {
return reports, err
}
- } else if err := ic.Libpod.RemoveContainer(ctx, c, true, true); err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
+ } else if err := ic.Libpod.RemoveContainer(ctx, c, true, true, options.Timeout); err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
return reports, err
}
}
diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go
index 6b432c214..028de9e81 100644
--- a/pkg/domain/infra/abi/pods.go
+++ b/pkg/domain/infra/abi/pods.go
@@ -259,7 +259,7 @@ func (ic *ContainerEngine) PodRm(ctx context.Context, namesOrIds []string, optio
reports := make([]*entities.PodRmReport, 0, len(pods))
for _, p := range pods {
report := entities.PodRmReport{Id: p.ID()}
- err := ic.Libpod.RemovePod(ctx, p, true, options.Force)
+ err := ic.Libpod.RemovePod(ctx, p, true, options.Force, options.Timeout)
if err != nil {
report.Err = err
}
diff --git a/pkg/domain/infra/abi/volumes.go b/pkg/domain/infra/abi/volumes.go
index 1610c0b48..e514631db 100644
--- a/pkg/domain/infra/abi/volumes.go
+++ b/pkg/domain/infra/abi/volumes.go
@@ -66,7 +66,7 @@ func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, op
}
for _, vol := range vols {
reports = append(reports, &entities.VolumeRmReport{
- Err: ic.Libpod.RemoveVolume(ctx, vol, opts.Force),
+ Err: ic.Libpod.RemoveVolume(ctx, vol, opts.Force, opts.Timeout),
Id: vol.Name(),
})
}
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index 9fe2d163c..3f78ba7bc 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -185,7 +185,9 @@ func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []st
func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, opts entities.RmOptions) ([]*entities.RmReport, error) {
// TODO there is no endpoint for container eviction. Need to discuss
options := new(containers.RemoveOptions).WithForce(opts.Force).WithVolumes(opts.Volumes).WithIgnore(opts.Ignore)
-
+ if opts.Timeout != nil {
+ options = options.WithTimeout(*opts.Timeout)
+ }
if opts.All {
ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, opts.Ignore, namesOrIds)
if err != nil {
diff --git a/pkg/domain/infra/tunnel/network.go b/pkg/domain/infra/tunnel/network.go
index 6f227f565..79fba1943 100644
--- a/pkg/domain/infra/tunnel/network.go
+++ b/pkg/domain/infra/tunnel/network.go
@@ -47,6 +47,9 @@ func (ic *ContainerEngine) NetworkReload(ctx context.Context, names []string, op
func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, opts entities.NetworkRmOptions) ([]*entities.NetworkRmReport, error) {
reports := make([]*entities.NetworkRmReport, 0, len(namesOrIds))
options := new(network.RemoveOptions).WithForce(opts.Force)
+ if opts.Timeout != nil {
+ options = options.WithTimeout(*opts.Timeout)
+ }
for _, name := range namesOrIds {
response, err := network.Remove(ic.ClientCtx, name, options)
if err != nil {
diff --git a/pkg/domain/infra/tunnel/pods.go b/pkg/domain/infra/tunnel/pods.go
index 8139216b3..bd3df1aa7 100644
--- a/pkg/domain/infra/tunnel/pods.go
+++ b/pkg/domain/infra/tunnel/pods.go
@@ -169,6 +169,9 @@ func (ic *ContainerEngine) PodRm(ctx context.Context, namesOrIds []string, opts
}
reports := make([]*entities.PodRmReport, 0, len(foundPods))
options := new(pods.RemoveOptions).WithForce(opts.Force)
+ if opts.Timeout != nil {
+ options = options.WithTimeout(*opts.Timeout)
+ }
for _, p := range foundPods {
response, err := pods.Remove(ic.ClientCtx, p.Id, options)
if err != nil {
diff --git a/pkg/domain/infra/tunnel/volumes.go b/pkg/domain/infra/tunnel/volumes.go
index 2b2b2c2a1..cfd1574c3 100644
--- a/pkg/domain/infra/tunnel/volumes.go
+++ b/pkg/domain/infra/tunnel/volumes.go
@@ -31,6 +31,9 @@ func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, op
reports := make([]*entities.VolumeRmReport, 0, len(namesOrIds))
for _, id := range namesOrIds {
options := new(volumes.RemoveOptions).WithForce(opts.Force)
+ if opts.Timeout != nil {
+ options = options.WithTimeout(*opts.Timeout)
+ }
reports = append(reports, &entities.VolumeRmReport{
Err: volumes.Remove(ic.ClientCtx, id, options),
Id: id,