summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-05 01:54:22 +0100
committerGitHub <noreply@github.com>2020-11-05 01:54:22 +0100
commit3ef721fa1f406d95fdc16b2ba46bf865b4a0433d (patch)
tree70c5af5d43d5ad1c7f0d6bd09bd6c788a452c0dd /libpod
parentab273a9cbd08e25e3794c606a863644eb3a06e30 (diff)
parenta47fe37a97b93911b4509636888018fa18de500d (diff)
downloadpodman-3ef721fa1f406d95fdc16b2ba46bf865b4a0433d.tar.gz
podman-3ef721fa1f406d95fdc16b2ba46bf865b4a0433d.tar.bz2
podman-3ef721fa1f406d95fdc16b2ba46bf865b4a0433d.zip
Merge pull request #8238 from joelsmith/master
Use regex for "pod ps" name filter to match "ps" behavior
Diffstat (limited to 'libpod')
-rw-r--r--libpod/filters/pods.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/libpod/filters/pods.go b/libpod/filters/pods.go
index adce9784c..0caa941dd 100644
--- a/libpod/filters/pods.go
+++ b/libpod/filters/pods.go
@@ -1,6 +1,7 @@
package lpfilters
import (
+ "regexp"
"strconv"
"strings"
@@ -78,7 +79,11 @@ func GeneratePodFilterFunc(filter, filterValue string) (
}, nil
case "name":
return func(p *libpod.Pod) bool {
- return strings.Contains(p.Name(), filterValue)
+ match, err := regexp.MatchString(filterValue, p.Name())
+ if err != nil {
+ return false
+ }
+ return match
}, nil
case "status":
if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created"}) {