filters: accept Docker-compat status values "dead" and "restarting"#28906
Closed
crawfordxx wants to merge 1 commit into
Closed
filters: accept Docker-compat status values "dead" and "restarting"#28906crawfordxx wants to merge 1 commit into
crawfordxx wants to merge 1 commit into
Conversation
The /libpod/containers/json (and compat) API documents "dead" and "restarting" as valid status filter values (matching Docker's API), but the implementation rejected them with: unknown container state: dead: invalid argument unknown container state: restarting: invalid argument Podman has no internal state that maps to either Docker concept, so no container will ever match these filters. The correct behavior is to accept the values without error and return an empty result set, rather than a 500 error. Fix the validation loop in GenerateContainerFilterFuncs to skip the StringToContainerStatus check for these two Docker-compat values. Fixes podman-container-tools#28904 Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
Contributor
Author
|
Superseded by #28926 which includes the same fix on the latest main branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The API documentation lists "dead" and "restarting" as valid status filter values, but both return a 500 error:
Podman has no internal state equivalent to Docker's dead or restarting states, so containers will never match these filters. The fix is to accept them without error rather than reject the request — callers get an empty list instead of a 500.
The validation loop in
GenerateContainerFilterFuncsnow skips theStringToContainerStatuscheck for these two Docker-compat values. The filter closure itself needs no change since neither "dead" nor "restarting" will ever match a Podman container state string.A bats test was added to
040-ps.batsto verify both values are accepted and return empty results.Fixes #28904