Skip to content

Commit 3769575

Browse files
lzapclaude
andcommitted
Refs #39673 - Use SeedHelper.format_errors in seeds
The top-level format_errors seed helper in Foreman core is deprecated (since 3.4) and is being removed (Foreman #39667). Call SeedHelper.format_errors directly, which has been available since the helper was deprecated and works on all supported Foreman versions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent afdec5a commit 3769575

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

db/seeds.d/60-ssh_proxy_feature.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
f = Feature.where(:name => 'SSH').first_or_create
2-
raise "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
2+
raise "Unable to create proxy feature: #{SeedHelper.format_errors(f)}" if f.nil? || f.errors.any?
33

44
f = Feature.where(:name => 'Script').first_or_create
5-
raise "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
5+
raise "Unable to create proxy feature: #{SeedHelper.format_errors(f)}" if f.nil? || f.errors.any?

db/seeds.d/90-bookmarks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
b = Bookmark.where(:name => input[:name], :controller => input[:controller]).first || Bookmark.new
1616
b.attributes = attributes
1717
b.save
18-
raise "Unable to create bookmark: #{format_errors b}" if b.errors.any?
18+
raise "Unable to create bookmark: #{SeedHelper.format_errors(b)}" if b.errors.any?
1919
end
2020
end

db/seeds.d/95-mail_notifications.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
created_notification = RexMailNotification.create(notification)
1919
if created_notification.nil? || created_notification.errors.any?
2020
raise ::Foreman::Exception.new(N_("Unable to create mail notification: %s"),
21-
format_errors(created_notification))
21+
SeedHelper.format_errors(created_notification))
2222
end
2323
end
2424
end

0 commit comments

Comments
 (0)