-
Notifications
You must be signed in to change notification settings - Fork 900
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
Dialog#destroy should ignore resource actions linking nonexisting entities #19574
Conversation
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.
So while conceptually I disagree since I think the issue's entirely self-inflicted, this looks good and I'm fine with it irl.
Thanks for the help, @himdel.
…ities Currently, if you have a Dialog associated with a Custom Button, and `delete` the custom button (as opposed to `destroy`; that should not happen, but apparently does), deleting the dialog will fail, because `ra.resource_type.constantize.find(ra.resource_id)` throws an exception as the resource no longer exists. (The resource being a removed custom button.) So, updating `reject_if_has_resource_action` to ignore resource actions pointing to nonexistent resources. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1770300
Checked commit https://github.com/himdel/manageiq/commit/773a1547fb99d0fb1b91d28ce1f6ce5f53f44490 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 app/models/dialog.rb
spec/models/dialog_spec.rb
|
Hammer backport details:
|
Dialog#destroy should ignore resource actions linking nonexisting entities (cherry picked from commit 79a77cd) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1783383
@himdel Travis is failing in hammer branch. Please take a look.
|
Dialog#destroy should ignore resource actions linking nonexisting entities (cherry picked from commit 79a77cd) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1783382
Ivanchuk backport details:
|
Currently, if you have a Dialog associated with a Custom Button,
and
delete
the custom button (as opposed todestroy
; that should not happen, but apparently does),deleting the dialog will fail, because
ra.resource_type.constantize.find(ra.resource_id)
throws an exception as the resource no longer exists. (The resource being a removed custom button.)So, updating
reject_if_has_resource_action
to ignore resource actions pointing to nonexistent resources.Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1770300
@miq-bot add_label bug, hammer/yes, ivanchuk/yes
I'm more convinced that this fixes the BZ, than that the problem is something we should fix.
However, for custom buttons, this is not the first time it happened (#19573 and ManageIQ/manageiq-schema#370 being mildly related),
so IMO it makes sense to make sure we don't crash in such situations.
Cc @d-m-u, feel free to disagree ;)