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 #35316 - enhance template-seed error-report #9336

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

m-bucher
Copy link
Contributor

@m-bucher m-bucher commented Aug 2, 2022

I had the problem, that a template could not be seeded, because the Metadata was not valid YAML and therefore could not be parsed metadata therefore being empty, the seed reported that name was missing.
Having name: in all templates I was pretty puzzled.

This fix will:

  • report empty parsed metadata as 'Metadata could not be parsed'
  • log the path of a template that produces errors during it's seeding

@theforeman-bot
Copy link
Member

Issues: #35316

Copy link
Member

@ares ares left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two suggestions, otherwise a good addition. Just to be clear, it was not any of the default templates we ship today, correct? Otherwise we should fix it too.

lib/seed_helper.rb Outdated Show resolved Hide resolved
lib/seed_helper.rb Outdated Show resolved Hide resolved
@m-bucher
Copy link
Contributor Author

m-bucher commented Aug 4, 2022

Just to be clear, it was not any of the default templates we ship today, correct? Otherwise we should fix it too.

No, it was a development version of #9322

lib/seed_helper.rb Outdated Show resolved Hide resolved
@m-bucher
Copy link
Contributor Author

@ares anything else keeping this from being merged that I can fix?

@@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot that I really really wanted to have the failing template's path in here 😇

@m-bucher m-bucher force-pushed the template_seed_error_handling branch from 4940ec5 to 600ada8 Compare August 1, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants