Show error on bad name filter in podman ps
Signed-off-by: Joel Smith <joelsmith@redhat.com>
This commit is contained in:
		
							parent
							
								
									dc58d4e285
								
							
						
					
					
						commit
						708d62078d
					
				|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue