Project

General

Profile

Actions

Bug #21798

open

gracefully handle package profile upload when host is not found

Added by Chris Duryee over 6 years ago. Updated over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
Hosts
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Currently, if you do a package profile upload and the host gets deleted while the task is in the queue, the task will go into stopped/warning which is correct behavior. However it will also log this (top few lines shown):

2017-11-28 12:27:14  [foreman-tasks/action] [E] Couldn't find Host::Managed with 'id'=582 [WHERE "hosts"."type" IN ('Host::Managed')] (ActiveRecord::RecordNotFound)
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/finder_methods.rb:324:in `raise_record_not_found_exception!'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/finder_methods.rb:444:in `find_one'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/finder_methods.rb:423:in `find_with_ids'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/finder_methods.rb:71:in `find'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/querying.rb:3:in `find'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/core.rb:131:in `find'
 | /usr/share/foreman/app/models/host.rb:15:in `method_missing'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.6.0/app/lib/actions/katello/host/upload_package_profile.rb:33:in `run'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.32/lib/dynflow/action.rb:518:in `block (3 levels) in execute_run'

We can't guarantee the host will exist during the block, but if we could catch RecordNotFound and log an error message along the lines of "host X no longer exists", that would be much better.

Actions #1

Updated by Justin Sherrill over 6 years ago

  • Category set to Hosts
  • translation missing: en.field_release set to 114
Actions

Also available in: Atom PDF