Module: Katello::Concerns::HostgroupExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/katello/concerns/hostgroup_extensions.rb
Instance Method Summary collapse
- #add_organization_for_environment ⇒ Object
- #content_and_puppet_match? ⇒ Boolean
-
#content_source ⇒ Object
instead of calling nested_attribute_for(:content_source_id) in Foreman, define the methods explictedly.
- #content_view ⇒ Object
- #inherited_content_source_id ⇒ Object
- #inherited_content_view_id ⇒ Object
- #inherited_kickstart_repository_id ⇒ Object
- #inherited_lifecycle_environment_id ⇒ Object
- #lifecycle_environment ⇒ Object
- #rhsm_organization_label ⇒ Object
Instance Method Details
#add_organization_for_environment ⇒ Object
59 60 61 62 63 64 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 59 def add_organization_for_environment #ensures that the group's orgs include whatever lifecycle environment is assigned if self.lifecycle_environment && !self.organizations.include?(self.lifecycle_environment.organization) self.organizations << self.lifecycle_environment.organization end end |
#content_and_puppet_match? ⇒ Boolean
66 67 68 69 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 66 def content_and_puppet_match? self.content_view && self.lifecycle_environment && self.content_view == self.environment.try(:content_view) && self.lifecycle_environment == self.environment.try(:lifecycle_environment) end |
#content_source ⇒ Object
instead of calling nested_attribute_for(:content_source_id) in Foreman, define the methods explictedly
33 34 35 36 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 33 def content_source return super if ancestry.nil? || self.content_source_id.present? SmartProxy.find_by(:id => inherited_content_source_id) end |
#content_view ⇒ Object
22 23 24 25 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 22 def content_view return super if ancestry.nil? || self.content_view_id.present? Katello::ContentView.find_by(:id => inherited_content_view_id) end |
#inherited_content_source_id ⇒ Object
38 39 40 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 38 def inherited_content_source_id inherited_ancestry_attribute(:content_source_id) end |
#inherited_content_view_id ⇒ Object
42 43 44 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 42 def inherited_content_view_id inherited_ancestry_attribute(:content_view_id) end |
#inherited_kickstart_repository_id ⇒ Object
50 51 52 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 50 def inherited_kickstart_repository_id inherited_ancestry_attribute(:kickstart_repository_id) end |
#inherited_lifecycle_environment_id ⇒ Object
46 47 48 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 46 def inherited_lifecycle_environment_id inherited_ancestry_attribute(:lifecycle_environment_id) end |
#lifecycle_environment ⇒ Object
27 28 29 30 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 27 def lifecycle_environment return super if ancestry.nil? || self.lifecycle_environment_id.present? Katello::KTEnvironment.find_by(:id => inherited_lifecycle_environment_id) end |
#rhsm_organization_label ⇒ Object
54 55 56 57 |
# File 'app/models/katello/concerns/hostgroup_extensions.rb', line 54 def rhsm_organization_label #used for rhsm registration snippet, since hostgroup can belong to muliple organizations, use lifecycle environment or cv (self.lifecycle_environment || self.content_view).try(:organization).try(:label) end |