Project

General

Profile

« Previous | Next » 

Revision e266478d

Added by Stephen Hoekstra over 10 years ago

fixes #4186 - db:seed fails when install media exists with same URL

(cherry picked from commit 202770a1d64f6beae3b1b8ba156d86345c061699)

View differences:

db/seeds.rb
{ :name => "OpenSUSE mirror", :os_family => "Suse", :path => "http://download.opensuse.org/distribution/$major.$minor/repo/oss", :operatingsystems => os_suse },
{ :name => "Ubuntu mirror", :os_family => "Debian", :path => "http://archive.ubuntu.com/ubuntu/" }
].each do |input|
next if Medium.find_by_name(input[:name])
next if Medium.where(['name = ? OR path = ?', input[:name], input[:path]]).any?
next if audit_modified? Medium, input[:name]
m = Medium.create input
raise "Unable to create medium: #{format_errors m}" if m.nil? || m.errors.any?

Also available in: Unified diff