summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/ps.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index 8cec73b3c..f795ee278 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -235,7 +235,7 @@ func psCmd(c *cli.Context) error {
if opts.Filter != "" {
filters := strings.Split(opts.Filter, ",")
for _, f := range filters {
- filterSplit := strings.Split(f, "=")
+ filterSplit := strings.SplitN(f, "=", 2)
if len(filterSplit) < 2 {
return errors.Errorf("filter input must be in the form of filter=value: %s is invalid", f)
}
@@ -303,9 +303,16 @@ func generateContainerFilterFuncs(filter, filterValue string, runtime *libpod.Ru
return strings.Contains(c.ID(), filterValue)
}, nil
case "label":
+ var filterArray []string = strings.Split(filterValue, "=")
+ var filterKey string = filterArray[0]
+ if len(filterArray) > 1 {
+ filterValue = filterArray[1]
+ } else {
+ filterValue = ""
+ }
return func(c *libpod.Container) bool {
- for _, label := range c.Labels() {
- if label == filterValue {
+ for labelKey, labelValue := range c.Labels() {
+ if labelKey == filterKey && ("" == filterValue || labelValue == filterValue) {
return true
}
}