Module: Content::HostExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/content/host_extensions.rb

Instance Method Summary collapse

Instance Method Details

#all_product_idsObject



29
30
31
# File 'app/models/concerns/content/host_extensions.rb', line 29

def all_product_ids
  (inherited_product_ids + product_ids).uniq
end

#attached_repositoriesObject



33
34
35
# File 'app/models/concerns/content/host_extensions.rb', line 33

def attached_repositories
  Content::Repository.attached_to_host(self)
end

#inherited_product_idsObject

product_ids from the os default and hostgroup.



22
23
24
25
26
27
# File 'app/models/concerns/content/host_extensions.rb', line 22

def inherited_product_ids
  products = []
  products += operatingsystem.product_ids if operatingsystem
  products += Content::HostgroupProduct.where(:hostgroup_id => hostgroup.path_ids).pluck(:product_id) if hostgroup_id
  products.uniq
end

#params_with_repositoriesObject

adds repository hash to ENC global parameters



14
15
16
17
18
19
# File 'app/models/concerns/content/host_extensions.rb', line 14

def params_with_repositories
  # convert all repos to a format that puppet create_resource with yumrepo can consume
  repos = Hash[attached_repositories.map { |repo| [repo.to_label, format_repo(repo)] }]
  # adds a global parameter called repositories contain all repos
  params_without_repositories.merge('repositories' => repos)
end