-
Notifications
You must be signed in to change notification settings - Fork 897
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
Get rid of the condition modifier. #16213
Conversation
@lfu Does the import logic need to be modified to handle older policy imports that would still contain the |
Does this change require the logic in existing policy conditions to be flipped around to ensure same outcome as was with the modifier? |
@gtanzillo Depends on how the condition is specified. @moolitayer Can you verify this for |
7e68a66
to
26e30bd
Compare
@gmcculloug Condition modifier is really meant for built in policies only. Control and compliance policies can set up actions for both success and failure conditions. There is no need to use the condition modifier. And there is no way to set the condition modifier when adding a policy via UI. In short, I think we don't need to touch the policy import/export logic. |
Yes @lfu , tomorrow hopefully |
I've downloaded this PR @lfu and prepared to test it after upgrade (attach policy in master then checkout your branch and test if that works) I'm afraid I haven't been able to run bin/setup since that (probably not related to the PR)
|
@moolitayer I hit the same issue when reviewing another PR :)
|
@gtanzillo @dclarizio Please review. |
@moolitayer Do we need to negate the condition for OpenSCAP? |
I'm sorry @lfu I still haven't been able to run refresh @cben @enoodle can one of you maybe help test this I've been stuck on ManageIQ/manageiq-providers-kubernetes#136 for a few days now for testing this, but it seems like a local problem See: |
@lfu I tested this for OpenSCAP and the conditions should be negated. (except the one with the empty condition). |
@lfu I was finally able to test this. The behavior now is not as expected[1] We could negate the conditions for modifier=deny (or update Unfortunately users can copy policies (In the user guide we are even suggesting users copy the OpenSCAP policy in order to modify it) I love the simplification done here, AFAIU we will need a different migration [1] pull/16213: |
This pull request is not mergeable. Please rebase and repush. |
26e30bd
to
a48165c
Compare
@lfu let me know if you want me to test how the new version works with the OpenSCAP policy. [1] I haven't run a migration from manageiq-schema lately, is defining manageiq-schema as a local plugin and running db:migrate from the root ManageIQ enough? |
[1] I haven't run a migration from manageiq-schema lately, is defining
manageiq-schema as a local plugin and running db:migrate from the root
ManageIQ enough?
I've done this recently, yes, it's enough. And db:migrate says which
migrations it runs so it's easy to verify.
(If you need to operate *inside* the manageiq-schema checkout on its dummy
DB, there you need `bin/setup` and for many things `export RAILS_ENV=test`)
|
a48165c
to
9938c08
Compare
@gtanzillo @dclarizio @gmcculloug Anything to update? |
Checked commits lfu/manageiq@4a05784~...9938c08 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 app/models/miq_policy.rb
|
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 👍
condition modifier was removed from models in ManageIQ/manageiq#16213 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1633606
Get rid of the condition modifier which is confusing and not necessary.
Control and compliance policy actions can be set basing on condition success, failure or both.
However, the action for built in policies is defined only for a true condition and is executed when condition is met. But the old logic would invoke actions only upon false condition result. So the old logic uses condition modifier 'deny' to force a true condition result into false and vice versa.
This flipping around seems not necessary and should be avoid to make a simple person's life easier and happier.
If a control policy has condition modifier set as 'deny', the actions for false condition would be invoked when the condition is actually met and vice versa.
There is no way to specify the condition modifier when adding a policy via UI. It can be done only via yaml file.
I won't be surprised if you find this confusing :)
Depends on ManageIQ/manageiq-schema#95
cc @gtanzillo @moolitayer
@miq-bot assign @gmcculloug
@miq-bot add_label bug, fine/yes
https://bugzilla.redhat.com/show_bug.cgi?id=1499161