Sha256: 94227c47845740121a4e5814327dc7c4e915046d33dfd0024d6952b874313f35

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

kind = TemplateKind.where(:name => 'Bootdisk').first_or_create

ProvisioningTemplate.without_auditing do
  content = File.read(File.join(ForemanBootdisk::Engine.root, 'app', 'views', 'foreman_bootdisk', 'host.erb'))
  tmpl = ProvisioningTemplate.where(:name => 'Boot disk iPXE - host').first_or_create do |template|
    template.attributes = {
      :template_kind_id => kind.id,
      :snippet => false,
      :template => content
    }
  end
  tmpl.attributes = {
    :template => content,
    :default  => true,
    :vendor   => "Foreman boot disk",
  }
  tmpl.locked = true
  tmpl.save!(:validate => false) if tmpl.changes.present?

  content = File.read(File.join(ForemanBootdisk::Engine.root, 'app', 'views', 'foreman_bootdisk', 'generic_host.erb'))
  tmpl = ProvisioningTemplate.where(:name => 'Boot disk iPXE - generic host').first_or_create do |template|
    template.attributes = {
      :template_kind_id => kind.id,
      :snippet => false,
      :template => content
    }
  end
  tmpl.attributes = {
    :template => content,
    :default  => true,
    :vendor   => "Foreman boot disk",
  }
  tmpl.locked = true
  tmpl.save!(:validate => false) if tmpl.changes.present?
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_bootdisk-7.0.1 db/seeds.d/50-bootdisk_templates.rb
foreman_bootdisk-8.0.0 db/seeds.d/50-bootdisk_templates.rb
foreman_bootdisk-7.0.0 db/seeds.d/50-bootdisk_templates.rb
foreman_bootdisk-6.1.0 db/seeds.d/50-bootdisk_templates.rb