Skip to content
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

Add model associations for containers graph refresh #15298

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/container_env_var.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class ContainerEnvVar < ApplicationRecord
belongs_to :container_definition
end
1 change: 1 addition & 0 deletions app/models/container_port_config.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class ContainerPortConfig < ApplicationRecord
# :port, :host_port, :protocol
belongs_to :container_definition
end
14 changes: 14 additions & 0 deletions app/models/manageiq/providers/container_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ class ContainerManager < BaseManager
has_many :container_build_pods, :foreign_key => :ems_id, :dependent => :destroy
has_many :container_templates, :foreign_key => :ems_id, :dependent => :destroy
has_one :container_deployment, :foreign_key => :deployed_ems_id, :inverse_of => :deployed_ems

# Shortcuts to chained joins, mostly used by inventory refresh.
has_many :computer_systems, :through => :container_nodes
has_many :computer_system_hardwares, :through => :computer_systems, :source => :hardware
has_many :computer_system_operating_systems, :through => :computer_systems, :source => :operating_system
has_many :container_volumes, :through => :container_groups
has_many :container_definitions, :through => :container_groups
has_many :container_port_configs, :through => :container_definitions
has_many :container_env_vars, :through => :container_definitions
has_many :security_contexts, :through => :container_definitions
has_many :container_service_port_configs, :through => :container_services
has_many :container_routes, :through => :container_services
Copy link

@zeari zeari Jun 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this how we get routes? i thought ems was their direct parent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_many :container_quota_items, :through => :container_quotas
has_many :container_limit_items, :through => :container_limits
has_many :container_template_parameters, :through => :container_templates

# Archived entities to destroy when the container manager is deleted
has_many :old_container_groups, :foreign_key => :old_ems_id, :dependent => :destroy, :class_name => "ContainerGroup"
Expand Down