diff --git a/lib/seed_helper.rb b/lib/seed_helper.rb index 38210ace6889..fef77b6b3a0f 100644 --- a/lib/seed_helper.rb +++ b/lib/seed_helper.rb @@ -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, it seems to be empty" 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? @@ -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 + Foreman::Logging.exception("Error in seeding the template #{path.inspect} metadata #{e.message}", e) + raise e end end