Skip to content

Commit

Permalink
Fixes #35316 - enhance template-seed error-report
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bucher committed Aug 2, 2022
1 parent f28bc34 commit e0a26fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/seed_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def update_role_permissions(role, options)

def import_raw_template(contents, vendor = 'Foreman')
metadata = Template.parse_metadata(contents)
raise "Metadata could not be parsed" if metadata.empty?
raise "Attribute 'name' is required in metadata in order to seed the template" if metadata['name'].nil?
raise "Attribute 'model' is required in metadata in order to seed the template" if metadata['model'].nil?

Expand Down Expand Up @@ -138,6 +139,9 @@ def import_raw_template(contents, vendor = 'Foreman')
def import_templates(template_paths, vendor = 'Foreman')
template_paths.each do |path|
import_raw_template(File.read(path), vendor)
rescue RuntimeError => e
logger.error("ERROR #{e} parsing #{path.inspect}")
raise e
end
end

Expand Down

0 comments on commit e0a26fd

Please sign in to comment.