Sha256: c2cb1bfdeee56dee019c40abd0cbd13ad4f57316ab93f38f43ea7972e27638cc

Contents?: true

Size: 822 Bytes

Versions: 7

Compression:

Stored size: 822 Bytes

Contents

class DisownForemanTemplates < ActiveRecord::Migration
  class FakeConfigTemplate < ApplicationRecord
    if ActiveRecord::Base.connection.table_exists?('config_templates')
      self.table_name = 'config_templates'
    else
      self.table_name = 'templates'
    end
  end

  def up
    update_templates_attributes :locked => false, :vendor => nil
  end

  def down
    update_templates_attributes :locked => true, :vendor => 'Katello'
  end

  private

  def update_templates_attributes(attribute_hash)
    templates = ["puppet.conf", "freeipa_register", "Kickstart default iPXE", "Kickstart default PXELinux", "PXELinux global default"]

    templates.each do |template|
      if (template = FakeConfigTemplate.find_by(:name => template))
        template.update_attributes(attribute_hash)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-3.5.2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.5.1.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.5.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.5.0.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.5.0 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.5.0.rc2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.5.0.rc1 db/migrate/20141209103005_disown_foreman_templates.rb