Revision e17a39ff
Added by Marek Hulán about 8 years ago
db/seeds.d/07-provisioning_templates.rb | ||
---|---|---|
end
|
||
|
||
# Provisioning templates
|
||
organizations = Organization.all
|
||
locations = Location.all
|
||
ProvisioningTemplate.without_auditing do
|
||
[
|
||
# Generic PXE files
|
||
... | ... | |
:snippet => false,
|
||
:template => File.read(File.join("#{Rails.root}/app/views/unattended", input.delete(:source)))
|
||
}.merge(input))
|
||
|
||
if t.default?
|
||
t.organizations = organizations if SETTINGS[:organizations_enabled]
|
||
t.locations = locations if SETTINGS[:locations_enabled]
|
||
end
|
||
|
||
raise "Unable to create template #{t.name}: #{format_errors t}" if t.nil? || t.errors.any?
|
||
end
|
||
end
|
db/seeds.d/08-partition_tables.rb | ||
---|---|---|
# Partition tables
|
||
organizations = Organization.all
|
||
locations = Location.all
|
||
Ptable.without_auditing do
|
||
[
|
||
{ :name => 'AutoYaST entire SCSI disk', :os_family => 'Suse', :source => 'autoyast/disklayout_scsi.erb' },
|
||
... | ... | |
p = Ptable.create({
|
||
:layout => File.read(File.join("#{Rails.root}/app/views/unattended", input.delete(:source)))
|
||
}.merge(input.merge(:default => true)))
|
||
|
||
if p.default?
|
||
p.organizations = organizations if SETTINGS[:organizations_enabled]
|
||
p.locations = locations if SETTINGS[:locations_enabled]
|
||
end
|
||
|
||
raise "Unable to create partition table: #{format_errors p}" if p.nil? || p.errors.any?
|
||
end
|
||
end
|
Also available in: Unified diff
Fixes #14586 - Associate default templates to Orgs and Locs during seed
(cherry picked from commit 2fb0d8d129588a71dcb953b12fe84d2fd8154467)