-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filters: better handling of id= #18798
Conversation
365ed47
to
22dabb9
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, zhangguanzhang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also have to fix this for pod filters.
I will fix the network filters in c/common when this is merged.
Also considering that there was a fair bit of confusion about the docs I think you should clarify the behaviour there.
pkg/domain/filters/containers.go
Outdated
@@ -18,9 +19,20 @@ import ( | |||
func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpod.Runtime) (func(container *libpod.Container) bool, error) { | |||
switch filter { | |||
case "id": | |||
// we only have to match one ID | |||
hexRegex := regexp.MustCompile("[^0-9a-fA-F]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a global variable and use the "github.com/containers/storage/pkg/regexp"
package instead.
Other thatn @Luap99 's comments, LGTM |
44aca7c
to
3bc098a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For filter=id=XXX (containers, pods) and =ctr-ids=XXX (pods): if XXX is only hex characters, treat it as a PREFIX otherwise, treat it as a REGEX Add tests. Update documentation. And fix an incorrect help message. Fixes: containers#18471 Signed-off-by: Ed Santiago <[email protected]>
/lgtm |
For filter=id=XXX:
if XXX is only hex characters, treat it as a PREFIX
otherwise, treat it as a REGEX
Fixes: #18471
Signed-off-by: Ed Santiago [email protected]