From f1e7a07473958a9ba0f06f7c2f88105200f7a146 Mon Sep 17 00:00:00 2001 From: Jakub Guzik Date: Thu, 3 Jun 2021 22:48:43 +0200 Subject: Fix image prune --filter cmd behavior Image prune --filter is fully implemented in the api, http api yet not connected with the cli execution. User trying to use filters does not see the effect. This commit adds glue code to enable possiblity of using --filter in prune in the cli execution. Signed-off-by: Jakub Guzik --- cmd/podman/images/prune.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go index db645cc2e..52217c0d6 100644 --- a/cmd/podman/images/prune.go +++ b/cmd/podman/images/prune.go @@ -60,7 +60,15 @@ func prune(cmd *cobra.Command, args []string) error { return nil } } - + filterMap, err := common.ParseFilters(filter) + if err != nil { + return err + } + for k, v := range filterMap { + for _, val := range v { + pruneOpts.Filter = append(pruneOpts.Filter, fmt.Sprintf("%s=%s", k, val)) + } + } results, err := registry.ImageEngine().Prune(registry.GetContext(), pruneOpts) if err != nil { return err -- cgit v1.2.3-54-g00ecf