Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37850 - Support Rails 7.0 #190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ruby_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ jobs:
uses: theforeman/actions/.github/workflows/foreman_plugin.yml@v0
with:
plugin: foreman_templates
foreman_version: refs/pull/10299/head
6 changes: 4 additions & 2 deletions app/services/foreman_templates/parse_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def to_h(verbose = false)
:additional_errors => @additional_errors,
:additional_info => @additional_info,
:exception => @exception&.message,
:validation_errors => errors.to_h,
:validation_errors => errors,
:file => @template_file,
:type => @template.present? ? @template.class.name.underscore : nil
}
Expand All @@ -27,7 +27,9 @@ def to_h(verbose = false)
end

def errors
@template&.errors
@template&.errors&.messages&.transform_values do |v|
v.join(', ')
end
end

def corrupted_metadata
Expand Down
10 changes: 5 additions & 5 deletions test/unit/template_importer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ def audit_comment

template_res = find_result(results[:results], template.name)
refute template_res.imported
assert_equal template_res.errors.full_messages.first, "This template is locked. Please clone it to a new template to customize."
assert_equal template_res.errors[:base], "This template is locked. Please clone it to a new template to customize."

ptable_res = find_result(results[:results], ptable.name)
refute ptable_res.imported
assert_equal ptable_res.errors.full_messages.first, "This template is locked. Please clone it to a new template to customize."
assert_equal ptable_res.errors[:base], "This template is locked. Please clone it to a new template to customize."

snippet_res = find_result(results[:results], snippet.name)
refute snippet_res.imported
assert_equal snippet_res.errors.full_messages.first, "This template is locked. Please clone it to a new template to customize."
assert_equal snippet_res.errors[:base], "This template is locked. Please clone it to a new template to customize."

assert_equal @template_template, template.template
assert_equal @ptable_layout, ptable.layout
Expand Down Expand Up @@ -317,11 +317,11 @@ def keep_options_test_common(lock_setting)

template_res = find_result(results[:results], template.name)
refute template_res.imported
assert_equal template_res.errors.full_messages.first, "This template is locked. Please clone it to a new template to customize."
assert_equal template_res.errors[:base], "This template is locked. Please clone it to a new template to customize."

ptable_res = find_result(results[:results], ptable.name)
refute ptable_res.imported
assert_equal ptable_res.errors.full_messages.first, "This template is locked. Please clone it to a new template to customize."
assert_equal ptable_res.errors[:base], "This template is locked. Please clone it to a new template to customize."
results
end
end
Expand Down