Project

General

Profile

Bug #16014

Improve error message when media is not set properly

Added by Lukas Zapletal about 3 years ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Content Views
Target version:
Difficulty:
trivial
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When media is not set or not available via taxonomy, we generate error trace:

2016-08-05 12:28:16 [app] [W] Fetch TFTP boot files for mac52540028624f.lab.eng.rdu2.redhat.com task failed with the following error: undefined method `path' for nil:NilClass
 | NoMethodError: undefined method `path' for nil:NilClass
 | /usr/share/foreman/app/models/operatingsystem.rb:121:in `medium_uri'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.69/app/models/katello/concerns/redhat_extensions.rb:52:in `medium_uri_with_content_uri'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.69/app/models/katello/concerns/redhat_extensions.rb:86:in `block in boot_files_uri_with_content'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.69/app/models/katello/concerns/redhat_extensions.rb:85:in `collect'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.69/app/models/katello/concerns/redhat_extensions.rb:85:in `boot_files_uri_with_content'
 | /usr/share/foreman/app/models/operatingsystem.rb:183:in `pxe_files'
 | /usr/share/foreman/app/models/concerns/orchestration/tftp.rb:78:in `setTFTPBootFiles'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:162:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:107:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:99:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:99:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:35:in `on_save'

We should catch for exceptions in the orchestration code and issue error.


Related issues

Related to Foreman - Feature #15439: Improve invalid medium errorClosed2016-06-16

History

#1 Updated by Lukas Zapletal about 3 years ago

We need to check for StandardError in the setTFTPBootFiles method.

#2 Updated by Lukas Zapletal about 3 years ago

When doing this, put an ERF entry on our wiki with explanation of the error.

#3 Updated by Marek Hulán about 3 years ago

  • Category set to Orchestration

#4 Updated by Dominic Cleal about 3 years ago

#5 Updated by Dominic Cleal about 3 years ago

  • Project changed from Foreman to Katello
  • Category deleted (Orchestration)

This is already implemented in boot_files_uri in #15439, but the stack trace above looks like the issue is introduced by Katello which is not deferring to the original boot_files_uri method containing the safety checks.

I'd suggest whatever checks are in Foreman should be applied to Katello, or it should call, not override, the original method.

#6 Updated by Lukas Zapletal about 3 years ago

  • Category set to Content Views
  • Difficulty set to trivial

Oh right, I had this feeling I was fixing this already! Thanks. Over to Katello folks! Easy one.

For the record, the required change is to run through these checks when overriding the method: https://github.com/theforeman/foreman/pull/3597/files

#7 Updated by Justin Sherrill almost 3 years ago

  • Legacy Backlogs Release (now unused) set to 114

Also available in: Atom PDF