summaryrefslogtreecommitdiff
path: root/cmd/podman/images.go
diff options
context:
space:
mode:
authorKunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>2019-04-10 13:50:12 +0900
committerKunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>2019-04-11 09:18:31 +0900
commit034cc8a5aeac5c6df39e7b4b7229f95803159542 (patch)
treecfb896c17f888b37eb8e7aa00fb7bffdede54502 /cmd/podman/images.go
parent60ef8f8da90ec5200e62b79b24324fefde2c7036 (diff)
downloadpodman-034cc8a5aeac5c6df39e7b4b7229f95803159542.tar.gz
podman-034cc8a5aeac5c6df39e7b4b7229f95803159542.tar.bz2
podman-034cc8a5aeac5c6df39e7b4b7229f95803159542.zip
imagefilter dangling handling corrected
imagefilter dangling=<value> shall not be ignored. this PR handles the value and returns images accordingly. Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
Diffstat (limited to 'cmd/podman/images.go')
-rw-r--r--cmd/podman/images.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/podman/images.go b/cmd/podman/images.go
index 6133450be..79694ab75 100644
--- a/cmd/podman/images.go
+++ b/cmd/podman/images.go
@@ -5,6 +5,7 @@ import (
"fmt"
"reflect"
"sort"
+ "strconv"
"strings"
"time"
"unicode"
@@ -359,6 +360,9 @@ func CreateFilterFuncs(ctx context.Context, r *adapter.LocalRuntime, filters []s
var filterFuncs []imagefilters.ResultFilter
for _, filter := range filters {
splitFilter := strings.Split(filter, "=")
+ if len(splitFilter) != 2 {
+ return nil, errors.Errorf("invalid filter syntax %s", filter)
+ }
switch splitFilter[0] {
case "before":
before, err := r.NewImageFromLocal(splitFilter[1])
@@ -373,7 +377,11 @@ func CreateFilterFuncs(ctx context.Context, r *adapter.LocalRuntime, filters []s
}
filterFuncs = append(filterFuncs, imagefilters.CreatedAfterFilter(after.Created()))
case "dangling":
- filterFuncs = append(filterFuncs, imagefilters.DanglingFilter())
+ danglingImages, err := strconv.ParseBool(splitFilter[1])
+ if err != nil {
+ return nil, errors.Wrapf(err, "invalid filter dangling=%s", splitFilter[1])
+ }
+ filterFuncs = append(filterFuncs, imagefilters.DanglingFilter(danglingImages))
case "label":
labelFilter := strings.Join(splitFilter[1:], "=")
filterFuncs = append(filterFuncs, imagefilters.LabelFilter(ctx, labelFilter))