daemon returns errors when receiving unsupported prune filters#33023
daemon returns errors when receiving unsupported prune filters#33023thaJeztah merged 1 commit intomoby:masterfrom
Conversation
f83ec12 to
7722e4f
Compare
- container prune - volume prune - image prune - network prune Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
7722e4f to
71760ae
Compare
| @@ -25,6 +25,27 @@ var ( | |||
| // ErrPruneRunning is returned when a prune request is received while | |||
| // one is in progress | |||
| ErrPruneRunning = fmt.Errorf("a prune operation is already running") | |||
There was a problem hiding this comment.
I am also wondering if we could disable the export of error ErrPruneRunning ?
Since it is only used here.
But maybe out of the scope of this PR. 🐱
There was a problem hiding this comment.
Thanks.
Might be a candidate for another PR.
|
|
||
| containersAcceptedFilters = map[string]bool{ | ||
| "label": true, | ||
| "label!": true, |
There was a problem hiding this comment.
Should the ! actually be part of the filter name? Not sure how it's handled later on, but looks a bit tricky (i.e. label!=foo.bar would be accepted, but not label != foo.bar, correct?)
There was a problem hiding this comment.
I don't think the later is a valid syntax for filters (e.g. filters="label != foo.bar")
There was a problem hiding this comment.
- I agree that this is strange, following our discussion, I will open another PR to rewrite this logic.
- I don't think
filterscan contain any space, either.
There was a problem hiding this comment.
Looked up the PR that implemented it, and indeed the format is label!=key=val or label!=key. Negative matches on value alone don't seem to be supported (i.e., no label=key!=val), nor spaces in between (label != key=val etc.)
Lines 95 to 116 in 7025247
|
@gdevillele can you open an issue for tracking the changes on the way we match the filters? (perhaps write out which formats we want to support, if we want to support whitespace) |
|
@thaJeztah will do. Thanks for merging! |
- What I did
...now return errors if an unsupported filter is received.
container prune only accepts the following filters:
volume prune only accepts the following filters:
image prune only accepts the following filters:
network prune only accepts the following filters:
- How to verify it
Example:
docker container prune --filter <filter>=<key>=<value>if is not "label" or "until", you should get a daemon error.
- Description for the changelog
return errors to the client when receiving unsupported prune filters
- A picture of a cute animal (not mandatory but encouraged)
cc @thaJeztah @vdemeester