Sha256: e8057c73e25ff1a5f52ef01ae3a102565324d613785505ed43a5452cdacba568

Contents?: true

Size: 819 Bytes

Versions: 6

Compression:

Stored size: 819 Bytes

Contents

class DisownForemanTemplates < ActiveRecord::Migration
  class FakeConfigTemplate < ActiveRecord::Base
    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

6 entries across 6 versions & 1 rubygems

Version Path
katello-2.4.5 db/migrate/20141209103005_disown_foreman_templates.rb
katello-2.4.4 db/migrate/20141209103005_disown_foreman_templates.rb
katello-2.4.3 db/migrate/20141209103005_disown_foreman_templates.rb
katello-2.4.2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-2.4.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-2.4.0 db/migrate/20141209103005_disown_foreman_templates.rb