Bug 1848243

Summary: 'Applied Errata' report fails with error 'undefined method uptime_seconds'
Product: Red Hat Satellite Reporter: Ranjan Kumar <rankumar>
Component: ReportingAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WORKSFORME QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: ahumbe, dsinglet, gpadholi, mhulan
Target Milestone: UnspecifiedKeywords: Patch, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-03 12:17:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ranjan Kumar 2020-06-18 04:27:23 UTC
Description of problem: Generating 'Applied errata' report with 'Reboot' = true and Status = warning fails with error "undefined method `uptime_seconds' for nil:NilClass"

# hammer report-template generate --name 'Applied Errata' --inputs "Filter Errata Type  = all, Include Last Reboot = yes, Status = warning"
undefined method `uptime_seconds' for nil:NilClass

~~~
bd089ee4-9d39-4ee1-8d91-795cd466b0d8,2,1,,skipped,2020-06-02 16:08:56.977233,2020-06-02 16:08:57.055904,0.078670509,0.064980915,1,0,Dynflow::ExecutionPlan::Steps::RunStep,{"class":"Dynflow::ExecutionPlan::Steps::Error","exception_class":"NoMethodError","message":"undefined method `uptime_seconds' for nil:NilClass","backtrace":["/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.14.0.20/app/lib/katello/concerns/base_template_scope_extensions.rb:150:in `block (3 levels) in load_errata_applications'","/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.14.0.20/app/lib/katello/concerns/base_template_scope_extensions.rb:134:in `each'","/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.14.0.20/app/lib/katello/concerns/base_template_scope_extensions.rb:134:in `block (2 levels) in load_errata_applications'","/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation/delegation.rb
~~~

Version-Release number of selected component (if applicable): Satellite 6.7

Additional info:
After investigation found, If a host is deleted but task related to the host is present in the satellite.

Comment 2 Dominik Matoulek 2020-08-24 11:16:42 UTC
Created redmine issue https://projects.theforeman.org/issues/30687 from this bug

Comment 6 Ashish Humbe 2023-03-24 06:15:20 UTC
I tested this on Satellite 6.13 and 6.12, I am not able to reproduce this issue any more.