From 708d62078d2174cf2d7522b919348ebc12a1be19 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Fri, 6 Nov 2020 09:05:01 -0700 Subject: [PATCH] Show error on bad name filter in podman ps Signed-off-by: Joel Smith --- libpod/filters/containers.go | 2 ++ libpod/filters/pods.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libpod/filters/containers.go b/libpod/filters/containers.go index e38e024d26..da1b5b263e 100644 --- a/libpod/filters/containers.go +++ b/libpod/filters/containers.go @@ -11,6 +11,7 @@ import ( "github.com/containers/podman/v2/pkg/timetype" "github.com/containers/podman/v2/pkg/util" "github.com/pkg/errors" + "github.com/sirupsen/logrus" ) // GenerateContainerFilterFuncs return ContainerFilter functions based of filter. @@ -40,6 +41,7 @@ func GenerateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime) return func(c *libpod.Container) bool { match, err := regexp.MatchString(filterValue, c.Name()) if err != nil { + logrus.Errorf("Failed to compile regex for 'name' filter: %v", err) return false } return match diff --git a/libpod/filters/pods.go b/libpod/filters/pods.go index 0caa941dd3..7d12eefa65 100644 --- a/libpod/filters/pods.go +++ b/libpod/filters/pods.go @@ -9,6 +9,7 @@ import ( "github.com/containers/podman/v2/libpod/define" "github.com/containers/podman/v2/pkg/util" "github.com/pkg/errors" + "github.com/sirupsen/logrus" ) // GeneratePodFilterFunc takes a filter and filtervalue (key, value) @@ -81,6 +82,7 @@ func GeneratePodFilterFunc(filter, filterValue string) ( return func(p *libpod.Pod) bool { match, err := regexp.MatchString(filterValue, p.Name()) if err != nil { + logrus.Errorf("Failed to compile regex for 'name' filter: %v", err) return false } return match