-
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
Delete archived entities when a container manager is deleted #14359
Delete archived entities when a container manager is deleted #14359
Conversation
3001e82
to
f520da0
Compare
f520da0
to
132148a
Compare
@@ -22,6 +22,12 @@ class ContainerManager < BaseManager | |||
has_one :container_deployment, :foreign_key => :deployed_ems_id, :inverse_of => :deployed_ems | |||
has_many :computer_systems, :through => :container_nodes | |||
|
|||
# Archived entities to destroy when the container manager is deleted | |||
has_many :old_container_groups, :foreign_key => :old_ems_id, :dependent => :destroy |
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.
@zeari Maybe I am mistaken but it seems to me that you need to tell it the type of the class to use when it is not clear :class_name => "ContainerGroups"
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.
@enoodle right
# Archived entities to destroy when the container manager is deleted | ||
has_many :old_container_groups, :foreign_key => :old_ems_id, :dependent => :destroy | ||
has_many :old_containers, :foreign_key => :old_ems_id | ||
has_many :old_container_definitions, :foreign_key => :old_ems_id |
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.
Where are the two above needed if they have no dependent destroy?
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.
@moolitayer destroying container_group
that destroys container_definition
that destroys container
I thought it was worth mentioning though
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 this is for documentation purposes?
Also do think you need
container_group.rb
...
has_many :old_container_definitions, :dependent => :destroy
container_definition.rb
...
has_many :old_containers, :dependent => :destroy ...
?
7a4754f
to
8eabf4a
Compare
So after some offline discussion with @zeari we came to a conclusion we should remove
As both those entities are removed through hierarchy. For example when a container definition is archived, it remains linked to it's container group (whether the container group is archived or not) |
8eabf4a
to
c8ceb77
Compare
Done |
Checked commit zeari@c8ceb77 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
ping @simon3z |
@simon3z Cannot apply the following label because they are not recognized: ewue/yes |
@miq-bot add_label euwe/yes |
@zeari Is there a BZ for this? Can you please create if it doesn't exist? |
…delete Delete archived entities when a container manager is deleted (cherry picked from commit 48d0291) https://bugzilla.redhat.com/show_bug.cgi?id=1458811
Euwe backport details:
|
…delete Delete archived entities when a container manager is deleted (cherry picked from commit 48d0291) https://bugzilla.redhat.com/show_bug.cgi?id=1460397
Fine backport details:
|
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1458552
Delete archived entities of a container manager when the ems is deleted. This causes various errors in reports that deal with archived entities
@moolitayer @enoodle Please review
cc @simon3z
@miq-bot add_label providers/containers, bug