Project

General

Profile

« Previous | Next » 

Revision 0fa5d146

Added by Dominic Cleal over 10 years ago

fixes #3752 - move data population from migrations into seed script

View differences:

db/migrate/20100419151910_add_owner_to_hosts.rb
updated = []
email = SETTINGS[:administrator] || "root@#{Facter.domain}"
owner = User.find_by_mail email
owner ||= User.find_or_create_by_login(:login => "admin", :admin => true, :firstname => "Admin", :lastname => "User", :mail => email)
owner ||= User.where(:admin => true).first
unless owner.nil? or owner.id.nil?
say "setting default owner for all hosts"
Host.update_all("owner_id = '#{owner.id}'")

Also available in: Unified diff