mirror of
https://github.com/containers/podman.git
synced 2025-06-25 12:20:42 +08:00
Merge pull request #20481 from vrothberg/fix-20469
compat API: fix image-prune --all
This commit is contained in:
@ -56,8 +56,19 @@ func (ir *ImageEngine) Prune(ctx context.Context, opts entities.ImagePruneOption
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !opts.All {
|
if !opts.All {
|
||||||
|
// Issue #20469: Docker clients handle the --all flag on the
|
||||||
|
// client side by setting the dangling filter directly.
|
||||||
|
alreadySet := false
|
||||||
|
for _, filter := range pruneOptions.Filters {
|
||||||
|
if strings.HasPrefix(filter, "dangling=") {
|
||||||
|
alreadySet = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !alreadySet {
|
||||||
pruneOptions.Filters = append(pruneOptions.Filters, "dangling=true")
|
pruneOptions.Filters = append(pruneOptions.Filters, "dangling=true")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if opts.External {
|
if opts.External {
|
||||||
pruneOptions.Filters = append(pruneOptions.Filters, "containers=external")
|
pruneOptions.Filters = append(pruneOptions.Filters, "containers=external")
|
||||||
} else {
|
} else {
|
||||||
|
@ -164,6 +164,8 @@ t DELETE libpod/images/test:test 200
|
|||||||
t GET images/json?filters='{"label":["xyz"]}' 200 length=0
|
t GET images/json?filters='{"label":["xyz"]}' 200 length=0
|
||||||
t GET libpod/images/json?filters='{"label":["xyz"]}' 200 length=0
|
t GET libpod/images/json?filters='{"label":["xyz"]}' 200 length=0
|
||||||
|
|
||||||
|
# Must not error out: #20469
|
||||||
|
t POST images/prune?filters='{"dangling":["false"]}' 200
|
||||||
|
|
||||||
# to be used in prune until filter tests
|
# to be used in prune until filter tests
|
||||||
podman image build -t test1:latest -<<EOF
|
podman image build -t test1:latest -<<EOF
|
||||||
|
Reference in New Issue
Block a user