-
Notifications
You must be signed in to change notification settings - Fork 914
Fix ProviderTagMapping removal leaving Classifications #23638
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
base: master
Are you sure you want to change the base?
Fix ProviderTagMapping removal leaving Classifications #23638
Conversation
A read-only Classification does not mean that it should not be deleted. Classifications that are seeded from fixtures aren't read_only which would be the only reason why we would want to prevent read_only deletion.
|
So while we don't want to prevent deletion at the model level, we do want to prevent the user from deleting or editing these via the UI/API. The API has the following logic: https://github.com/ManageIQ/manageiq-api/blob/master/app/controllers/api/categories_controller.rb#L7-L16 So while the API could be replaced with |
|
ReadOnlyMixin does want to prevent deletion at the model level, which is why it has a special bypass for seeding. That is, read_only generally means "seeded", and so that bypass allows deletion by the seeding code, but nothing else. In the case of Classifications though, I'm not sure it should, specifically because we have this whole mapped classification concept. So, I'm not sure if we should remove it here - I could be convinced though - need to think it through. I think part of the problem is that read_only was "reused" by the Provider Tag Mapping code, and possibly shouldn't have been. I'm not sure though what the right answer is - probably a "provider_owned" flag in addition to "read_only", and then some logic when both values (or one or the other) is set. |
Right that is why I dropped Also the seeded
If |
Right I'm saying they should have been (more bugs). Then again, users might want to add tags to the categories, or perhaps delete seeded ones (which doesn't work).
Sorry I didn't word my response correctly. read_only was correctly used if we go by the name of the column - we didn't want these deleted, so we set that field to true (no faults laid on the author that used it). However, traditionally read_only actually meant "seeded" (I've wanted to rename these columns forever but it's low on my priority list). So in that sense using the column meant for "seeded" records may not have been the correct choice, but I admit there's no way for people to know that based on that name. It's a mess :( . |
A read-only Classification does not mean that it should not be deleted. Classifications that are seeded from fixtures aren't read_only which would be the only reason why we would want to prevent read_only deletion.
When you try to delete a Tag Mapping you get an error:

And the Classification and Tag are still present:
Related #22232