1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

daemon/containerd: validate image filters

Not all filters are implemented yet, so make sure an error
is returned if a not-yet implemented filter is used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-07-21 11:01:10 +02:00
parent 4d3b32bf3d
commit 669fbed1ac
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -11,10 +11,22 @@ import (
"github.com/opencontainers/image-spec/identity"
)
var acceptedImageFilterTags = map[string]bool{
"dangling": false, // TODO(thaJeztah): implement "dangling" filter: see https://github.com/moby/moby/issues/43846
"label": true,
"before": true,
"since": true,
"reference": false, // TODO(thaJeztah): implement "reference" filter: see https://github.com/moby/moby/issues/43847
}
// Images returns a filtered list of images.
//
// TODO(thaJeztah): sort the results by created (descending); see https://github.com/moby/moby/issues/43848
func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) {
if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
return nil, err
}
filter, err := i.setupFilters(ctx, opts.Filters)
if err != nil {
return nil, err