Merge pull request #8238 from joelsmith/master

Use regex for "pod ps" name filter to match "ps" behavior
This commit is contained in:
OpenShift Merge Robot
2020-11-05 01:54:22 +01:00
committed by GitHub
2 changed files with 28 additions and 1 deletions

View File

@ -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"}) {