-
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
Clean up mapped tenants after a CloudManager is destroyed #17866
Clean up mapped tenants after a CloudManager is destroyed #17866
Conversation
526b7d0
to
b1c8d42
Compare
@agrare do you know who could review this? |
@@ -42,6 +42,8 @@ class << model_name | |||
include HasNetworkManagerMixin | |||
include HasManyOrchestrationStackMixin | |||
|
|||
after_destroy { |record| record.destroy_mapped_tenants } |
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.
You should be able to just do after_destroy :destroy_mapped_tenants
def destroy_mapped_tenants | ||
if source_tenant | ||
source_tenant.all_subtenants.destroy_all | ||
source_tenant.all_subprojects.destroy_all |
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.
Is it possible for these to be shared by any other providers?
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.
I don't believe so, the mappings should be unique to one provider as far as I understand it.
@mansam could you just add a |
@agrare I'll give that a shot, I hadn't considered it. |
b1c8d42
to
f58bfc9
Compare
Turns out I had actually already tried that when I first worked on this in August and just forgot. Trying to use
|
Checked commit mansam@f58bfc9 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Hm okay so you'd have to have some before_destroy to clear the sub-tenants first, and there isn't an actual relation for the sub tenants so I was hoping we could dependent destroy those as well but I guess not. |
@miq-bot add_label hammer/yes |
Sorry @mansam I kicked the tests then forgot to come back and check if it passed |
@agrare no worries, I figured you'd get to it eventually :) thanks for the merge! |
…s-destroy Clean up mapped tenants after a CloudManager is destroyed (cherry picked from commit 89a1ebf) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1547740
Hammer backport details:
|
Tenants created by cloud tenant mapping are not destroyed when their provider is destroyed, which prevents tenant mapping from working if the provider is readded with the same name. This PR causes the mapped tenant tree to be destroyed along with the provider.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1547740