Sha256: 93c1d94f18e6e2c8da3b6a90b7c2cb405e139a55e0f710bc7ba5ec92f4c79e12

Contents?: true

Size: 823 Bytes

Versions: 37

Compression:

Stored size: 823 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

37 entries across 37 versions & 1 rubygems

Version Path
katello-3.4.5 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.4 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.0.2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.0.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.0 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.0.rc2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.4.0.rc1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.1.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.0.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.0 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.0.rc2 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.0.rc1.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.3.0.rc1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.2.1.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.2.1 db/migrate/20141209103005_disown_foreman_templates.rb
katello-3.2.0 db/migrate/20141209103005_disown_foreman_templates.rb