Skip to content
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

nodes: filtering by multiple tags #377

Merged
merged 4 commits into from
May 21, 2019
Merged

nodes: filtering by multiple tags #377

merged 4 commits into from
May 21, 2019

Conversation

vjeffrey
Copy link

@vjeffrey vjeffrey commented May 16, 2019

🔩 Description

fixes #370

When creating a scan job, and filtering by tag values for the Automate node manager, we are currently unable to filter by multiple tags.

👍 Definition of Done

Able to filter nodes by multiple tags (Automate nodemanager)

👟 Demo Script / Repro Steps

rebuild nodemanager
create some nodes with different tags
create a scan job filtering by those tags

Victoria Jeffrey added 3 commits May 16, 2019 16:36
if len(oRConditionsForTags) == 0 {
whereFilter = fmt.Sprintf("WHERE (%s)", strings.Join(conditions, " AND "))
} else {
if len(conditions) > 0 {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this too messy? is there a cleaner way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is getting a bit convoluted with special cases. I think you could simplify somewhat by separating all the tag handling from the other filters. If you moved all the tag filter handling first, that stuff could be ORed together and added to the conditions as just another element, since those all get ANDed together at the end.

Hopefully that made sense, I was trying to avoid just writing a bunch of pseudocode.

Signed-off-by: Victoria Jeffrey <[email protected]>
@vjeffrey vjeffrey force-pushed the vj/filter-mult-tags branch from 1d3def8 to 234a876 Compare May 20, 2019 16:14
Copy link
Contributor

@phiggins phiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, very clear and concise. 👍

@vjeffrey vjeffrey merged commit f7212f8 into master May 21, 2019
@chef-ci chef-ci deleted the vj/filter-mult-tags branch May 21, 2019 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unable to filter by multiple tags when creating a scan job
2 participants