mirror of
https://github.com/containers/podman.git
synced 2025-06-20 09:03:43 +08:00
Allow filtering of "removing", it is a valid status
Do not use a list of statuses outside of libpod to validate container statuses. Removing status was never added to the list. Fixes: https://github.com/containers/podman/issues/13986 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -52,8 +52,8 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
|
||||
}, nil
|
||||
case "status":
|
||||
for _, filterValue := range filterValues {
|
||||
if !util.StringInSlice(filterValue, []string{"created", "running", "paused", "stopped", "exited", "unknown"}) {
|
||||
return nil, errors.Errorf("%s is not a valid status", filterValue)
|
||||
if _, err := define.StringToContainerStatus(filterValue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return func(c *libpod.Container) bool {
|
||||
|
@ -321,7 +321,11 @@ t GET containers/json?filters='garb1age}' 500 \
|
||||
t GET containers/json?filters='{"label":["testl' 500 \
|
||||
.cause="unexpected end of JSON input"
|
||||
|
||||
|
||||
#libpod api list containers sanity checks
|
||||
t GET libpod/containers/json?filters='{"status":["removing"]}' 200 length=0
|
||||
t GET libpod/containers/json?filters='{"status":["bogus"]}' 500 \
|
||||
.cause="invalid argument"
|
||||
t GET libpod/containers/json?filters='garb1age}' 500 \
|
||||
.cause="invalid character 'g' looking for beginning of value"
|
||||
t GET libpod/containers/json?filters='{"label":["testl' 500 \
|
||||
|
Reference in New Issue
Block a user