Skip to content

Helper Utils

Alberto Jesus Gutierrez Juanes edited this page Sep 10, 2017 · 1 revision

get Parent of a resource

HARDWARE_RESOURCE = %w(Vm Host EmsCluster ExtManagementSystem MiqEnterprise ).freeze CONTAINER_RESOURCE = %w(Container ContainerNode ContainerReplicator ContainerProject ExtManagementSystem MiqEnterprise).freeze

A container belongs to a container group if we see the container definition model, in this model we have all the relationships Container >> ContainerNode >> ContainerReplicator >> ContainerProject >> ExtManagementSystem

  belongs_to :container_group
  belongs_to :ext_management_system, :foreign_key => :ems_id
  has_one    :container_node, :through => :container_group
  has_one    :container_replicator, :through => :container_group
  has_one    :container_project, :through => :container_group
  has_one    :old_container_project, :through => :container_group
  belongs_to :container_image
  has_many   :container_port_configs, :dependent => :destroy
  has_many   :container_env_vars, :dependent => :destroy
  has_one    :container_image_registry, :through => :container_image
  has_one    :security_context, :as => :resource, :dependent => :destroy
Clone this wiki locally