Skip to content

Commit

Permalink
Add model associations for containers graph refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
cben committed Jun 5, 2017
1 parent 8cc469c commit 9962000
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
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
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

0 comments on commit 9962000

Please sign in to comment.