aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/utils/containers.go14
-rw-r--r--pkg/domain/infra/abi/containers.go3
2 files changed, 6 insertions, 11 deletions
diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go
index 80f8522fd..e198bdd6c 100644
--- a/pkg/api/handlers/utils/containers.go
+++ b/pkg/api/handlers/utils/containers.go
@@ -99,9 +99,8 @@ func WaitContainerDocker(w http.ResponseWriter, r *http.Request) {
func WaitContainerLibpod(w http.ResponseWriter, r *http.Request) {
var (
- err error
- interval = time.Millisecond * 250
- conditions = []define.ContainerStatus{define.ContainerStateStopped, define.ContainerStateExited}
+ err error
+ interval = time.Millisecond * 250
)
decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder)
query := waitQueryLibpod{}
@@ -118,17 +117,10 @@ func WaitContainerLibpod(w http.ResponseWriter, r *http.Request) {
}
}
- if _, found := r.URL.Query()["condition"]; found {
- if len(query.Condition) > 0 {
- conditions = query.Condition
- }
- }
-
name := GetName(r)
waitFn := createContainerWaitFn(r.Context(), name, interval)
-
- exitCode, err := waitFn(conditions...)
+ exitCode, err := waitFn(query.Condition...)
if err != nil {
if errors.Is(err, define.ErrNoSuchCtr) {
ContainerNotFound(w, name, err)
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 1688be57e..23a591604 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -101,6 +101,9 @@ func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []strin
responses := make([]entities.WaitReport, 0, len(ctrs))
for _, c := range ctrs {
response := entities.WaitReport{Id: c.ID()}
+ if options.Condition == nil {
+ options.Condition = []define.ContainerStatus{define.ContainerStateStopped, define.ContainerStateExited}
+ }
exitCode, err := c.WaitForConditionWithInterval(ctx, options.Interval, options.Condition...)
if err != nil {
response.Error = err