-
Notifications
You must be signed in to change notification settings - Fork 898
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
Regex event detection #20907
Regex event detection #20907
Conversation
78cb51d
to
4dd431d
Compare
sigh. stupid works for me locally test. |
This will require changing the defaults in each of the providers. This feature was added specifically to allow providers to provide more sane defaults than listing out every single possible event (e.g. https://github.com/ManageIQ/manageiq-providers-redfish/blob/master/config/settings.yml#L8-L9) We may also need a data migration if customers could change these. @agrare ? |
@agrare Please also review. |
4dd431d
to
5123806
Compare
part of ManageIQ/manageiq#20907 In order to better support json configuration settings, the regular expressions in settings.yml are being converted to strings. The event system is now responsible to handle the appropriately
part of ManageIQ/manageiq#20907 In order to better support json configuration settings, the regular expressions in settings.yml are being converted to strings. The event system is now responsible to handle the appropriately
part of ManageIQ/manageiq#20907 In order to better support json configuration settings, the regular expressions in settings.yml are being converted to strings. The event system is now responsible to handle the appropriately
part of ManageIQ/manageiq#20907 In order to better support json configuration settings, the regular expressions in settings.yml are being converted to strings. The event system is now responsible to handle the appropriately
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 when mixed with the provider PRs.
Can you update the OP to put all the links to the provider PRs, and if you haven't already, can we run a cross-repo-test?
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.
Actually, I'm looking closer and I think there's a bug -
I don't see any tests that actually test that the regex is being applied. The test from the regex just asks if it's in the list of filters to apply, but not if the filtering is actually being applied.
I have a feeling based on the code, that it's not actually working, because I don't see the code stripping off the leading and trailing /
characters.
[1] pry(main)> "abc".match("b.")
=> #<MatchData "bc">
[1] pry(main)> "abc".match("/b./")
=> nil
5123806
to
5827ab8
Compare
From Pull Request: ManageIQ/manageiq#20907
before, events expressions are stored in yaml as regular expressions. now, they are stored as a string with an opening/closing slash. Those are treated as regular expressions.
5827ab8
to
cdf4c28
Compare
From Pull Request: ManageIQ/manageiq#20907
Checked commit kbrock@cdf4c28 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint |
manageiq/spec/models/ems_event_spec.rb Lines 416 to 420 in c52be90
@kbrock Can you verify if there are tests around this functionality, and if not can you add a couple? |
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.
👍 looks great, much more targeted than the previous version
Overall LGTM...I still think it needs tests that exercise the actual regex.
From Pull Request: ManageIQ/manageiq#20907
Not sure if I already answered this question out of band. We do have a test that ensures regular expressions are applied and in the right order. I feel that the regular expression behavior has not changed (should not change) so the existing test will do what we need. manageiq/spec/models/ems_event_spec.rb Lines 445 to 450 in c52be90
|
@kbrock I want to confirm the merge order here, first this core pr, then the provider prs, then schema? |
@agrare yea - I'd do nuage, core, then other providers. You'd need to kick nuage again to ensure that it is green, but this order ensures the most green/happy builds if you prefer, we can change the code back to having core accept both inputs - so it would be green. Then we could remove at a later time when everything is green. (you and fry asked me to take that out. just offering if you have changed your mind) |
Nuage is green here https://travis-ci.com/github/ManageIQ/manageiq-cross_repo-tests/builds/221501032 so I'm good with that |
Part of #17201
Overview
The serialization of regular expressions in our yaml file is giving us issues when transitioning the data over json.
this breaks the react code that is transferring it
See issues in ManageIQ/manageiq-api#979
Solution
Store strings in yaml that are strings, but are detectable as being a regular expression.
This does transition the task of detecting it is a regular expression from yaml to ruby, but since that code already has special provisions for regular expression, it didn't seem to add too much additional knowledge.
Implementation
This is a single line change. but I had to do a little too much to get there.
Please look at individual commits to see what is the refactor and what is the actual change.
Tangent
I did not feel comfortable adding the regular expression logic in the loop. It is probably the same thing but this loop triggers events and needs to be as tight as possible.
It seems like we may be able to avoid this conversion every time. Especially since this is mostly relatively static. If we did that, we would see a big performance boost