Sha256: a40b7046fb06aa80bdc1b29f07ddac477e87dfe31699501a06228cdd7c51167f

Contents?: true

Size: 782 Bytes

Versions: 19

Compression:

Stored size: 782 Bytes

Contents

require_relative '../migrate/20180605150932_deprecate_satellite_templates'

module ProvisioningTemplateSeedExtensions
  extend ActiveSupport::Concern

  included do
    after_create :move_deprecated_defaults
  end

  def move_deprecated_defaults
    return unless (old_name = ForemanThemeSatellite::DEPRECATED_TEMPLATES.key(name))

    old_template = ProvisioningTemplate.unscoped.find_by(name: 'DEPRECATED ' + old_name)
    return unless old_template
    old_template.os_default_templates.update_all(provisioning_template_id: id)

    migration = DeprecateSatelliteTemplates.new
    migration.copy_template_combinations(old_template, self)
    migration.copy_operatingsystems(old_template, self)
    save!
  end
end

ProvisioningTemplate.include ProvisioningTemplateSeedExtensions

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
foreman_theme_satellite-14.3.1 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.3.5 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.3.4 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-14.3.0 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-14.2.0 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.3.3 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-14.1.0 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.3.2 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.3.1 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-14.0.1 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-14.0.0 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.3.0 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.2.5 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.2.4 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.2.3 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.2.2 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.2.1 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.2.0 db/seeds.d/069-provisioning_templates_defaults.rb
foreman_theme_satellite-13.1.0 db/seeds.d/069-provisioning_templates_defaults.rb