Project

General

Profile

Bug #465 ยป 0001-Fixed-465-Use-correct-condition-in-migration-AddOwne.patch

Proposed trivial patch, tested against PostgreSQL. - Jochen Schalanda, 11/14/2010 09:53 AM

View differences:

db/migrate/20100419151910_add_owner_to_hosts.rb
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)
unless owner.nil? and owner.id.nil?
unless owner.nil? or owner.id.nil?
say "setting default owner for all hosts"
Host.update_all("owner_id = '#{owner.id}'")
end
    (1-1/1)