Skip to content

Commit

Permalink
Merge pull request containers#8264 from joelsmith/master
Browse files Browse the repository at this point in the history
Show error on bad name filter in podman ps
  • Loading branch information
openshift-merge-robot authored Nov 6, 2020
2 parents dc58d4e + 708d620 commit e2b82e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libpod/filters/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libpod/filters/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e2b82e6

Please sign in to comment.