Sha256: bdea2173e9a71251c96eaf5de9bac07ee1ebea6aa6a3b606b7bd153e59796004
Contents?: true
Size: 1020 Bytes
Versions: 10
Compression:
Stored size: 1020 Bytes
Contents
module Katello module Concerns module OperatingsystemExtensions extend ActiveSupport::Concern included do after_create :assign_templates! end def assign_templates! # Automatically assign default templates if self.family == 'Redhat' TemplateKind.all.each do |kind| if (template = ProvisioningTemplate.find_by_name(Setting["katello_default_#{kind.name}"])) provisioning_templates << template unless provisioning_templates.include?(template) if OsDefaultTemplate.where(:template_kind_id => kind.id, :operatingsystem_id => id).empty? OsDefaultTemplate.create(:template_kind_id => kind.id, :provisioning_template_id => template.id, :operatingsystem_id => id) end end end if (ptable = Ptable.find_by_name(Setting["katello_default_ptable"])) ptables << ptable unless ptables.include?(ptable) end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems