Merge pull request #45092 from vvoland/c8d-dangling-filter-upstream
c8d/list: Support dangling filter
This commit is contained in:
commit
17f17c284c
1 changed files with 12 additions and 1 deletions
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
var acceptedImageFilterTags = map[string]bool{
|
||||
"dangling": false, // TODO(thaJeztah): implement "dangling" filter: see https://github.com/moby/moby/issues/43846
|
||||
"dangling": true,
|
||||
"label": true,
|
||||
"before": true,
|
||||
"since": true,
|
||||
|
@ -256,6 +256,17 @@ func (i *ImageService) setupFilters(ctx context.Context, imageFilters filters.Ar
|
|||
return imageFilters.MatchKVList("label", image.Labels)
|
||||
})
|
||||
}
|
||||
|
||||
if imageFilters.Contains("dangling") {
|
||||
danglingValue, err := imageFilters.GetBoolOrDefault("dangling", false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fltrs = append(fltrs, func(image images.Image) bool {
|
||||
return danglingValue == isDanglingImage(image)
|
||||
})
|
||||
}
|
||||
|
||||
return func(image images.Image) bool {
|
||||
for _, filter := range fltrs {
|
||||
if !filter(image) {
|
||||
|
|
Loading…
Reference in a new issue