Bug 2112385 - Generate All Reports Job Fails After Upgrade to 6.11 with Missing Logger Method
Summary: Generate All Reports Job Fails After Upgrade to 6.11 with Missing Logger Method
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: RH Cloud - Inventory
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.11.2
Assignee: Shimon Shtein
QA Contact: addubey
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-29 14:59 UTC by Odilon Sousa
Modified: 2022-10-19 00:08 UTC (History)
2 users (show)

Fixed In Version: rubygem-foreman_rh_cloud-5.0.41
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2110163
Environment:
Last Closed: 2022-08-30 19:43:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github theforeman foreman_rh_cloud pull 755 0 None Merged Add missing logger statement for GenerateAllReportsJob 2022-07-29 14:59:34 UTC
Red Hat Product Errata RHBA-2022:6233 0 None None None 2022-08-30 19:43:20 UTC

Description Odilon Sousa 2022-07-29 14:59:22 UTC
+++ This bug was initially created as a clone of Bug #2110163 +++

Description of problem:

After upgrading to Satellite 6.11, the Generate All Reports Job action fails in the Plan stage with "NameError (undefined local variable or method `logger'":

~~~
"ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateAllReportsJob)" | foreman-rake console
Loading production environment (Rails 6.0.4.7)
Switch to inspect mode.
ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateAllReportsJob)
Traceback (most recent call last):
       16: from foreman-tasks (5.2.3) lib/foreman_tasks.rb:26:in `block in trigger_task'
       15: from foreman-tasks (5.2.3) lib/foreman_tasks.rb:20:in `trigger'
       14: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_user.rb:9:in `plan'
       13: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_user.rb:41:in `with_current_user'
       12: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_user.rb:10:in `block in plan'
       11: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_taxonomies.rb:9:in `plan'
       10: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_taxonomies.rb:30:in `with_current_taxonomies'
        9: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_taxonomies.rb:10:in `block in plan'
        8: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_timezone.rb:9:in `plan'
        7: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_timezone.rb:31:in `with_current_timezone'
        6: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_timezone.rb:10:in `block in plan'
        5: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_request_id.rb:9:in `plan'
        4: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_request_id.rb:34:in `with_current_request_id'
        3: from foreman-tasks (5.2.3) app/lib/actions/middleware/keep_current_request_id.rb:10:in `block in plan'
        2: from foreman-tasks (5.2.3) app/lib/actions/middleware/load_setting_values.rb:15:in `plan'
        1: from foreman_rh_cloud (5.0.39) lib/foreman_inventory_upload/async/generate_all_reports_job.rb:13:in `plan'
NameError (undefined local variable or method `logger' for #<ForemanInventoryUpload::Async::GenerateAllReportsJob:0x00000000152a44e0>)
~~~

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


How reproducible:
Noticed this issue on Upgraded Satellite servers (new installs don't seem to hit this issue out of the box).  However, with a new install of 6.11, we can trigger this stack trace by changing the ":allow_auto_inventory_upload" setting to "No".

Steps to Reproduce:
1. Navigate to Administer => Settings, RH Cloud and changed the "Automatic inventory upload" to "No"
2. Run this rake command: "ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateAllReportsJob)" | foreman-rake console


Actual results:
Rake command fails with "NameError (undefined local variable or method `logger' for #<ForemanInventoryUpload::Async::GenerateAllReportsJob:0x00000000152a44e0>)"

Expected results:
Task should not fail with this error.

Additional info:
If we prepend the "GenerateAllReportsJob" class with this line, the error is no longer seen:

~~~
 logger = Rails.logger
~~~

--- Additional comment from  on 2022-07-28T15:52:11Z 

Moving to POST as PR merged.

Comment 7 errata-xmlrpc 2022-08-30 19:43:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Satellite 6.11.2 Async Bug Fix Update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:6233


Note You need to log in before you can comment on or make changes to this bug.