Bug 1907802

Summary: foreman-maintain paused task check fails.
Product: Red Hat Satellite Reporter: Suraj Patil <supatil>
Component: Satellite MaintainAssignee: Suraj Patil <supatil>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: apatel, gtalreja, kgaikwad, pcreech
Target Milestone: 6.9.0Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-0.7.2-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-21 14:48:24 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 Suraj Patil 2020-12-15 09:43:22 UTC
Description of problem:
foreman-maintain health check --label foreman-tasks-not-paused fails with the below error - "Please provide at least one of search or task_ids parameters in the request".


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

How reproducible:
Run one of the below commands. 

# foreman-maintain health check --label foreman-tasks-not-paused 
OR
# foreman-maintain upgrade check

Actual results:
The command fails with error - "Please provide at least one of search or task_ids parameters in the request"

Expected results:
It should try to resume all the paused tasks. 

Additional info:
Related Bugzilla - https://bugzilla.redhat.com/show_bug.cgi?id=1895324

Comment 1 Suraj Patil 2020-12-15 09:51:55 UTC
Created redmine issue https://projects.theforeman.org/issues/31512 from this bug

Comment 2 Bryan Kearney 2020-12-17 15:10:00 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/31512 has been resolved.

Comment 3 Gaurav Talreja 2021-01-15 12:42:54 UTC
Verified.

Tested on Satellite 6.9.0 Snap 9.
Version: rubygem-foreman_maintain-0.7.4-1.el7sat.noarch

Setup:
1. Have tasks with `state=paused` and `result=error`, Here I published a CV with few repos, and canceled it from UI, which results in the paused task.

Steps:
1. # hammer task list --search state=paused
-------------------------------------|----------------------------------------------------------------------------------|--------|--------|---------------------|----------|-------|--------------------------------------------
ID                                   | ACTION                                                                           | STATE  | RESULT | STARTED AT          | ENDED AT | OWNER | TASK ERRORS
-------------------------------------|----------------------------------------------------------------------------------|--------|--------|---------------------|----------|-------|--------------------------------------------
4728cba4-8531-4a08-98ec-6ff8193db52f | Publish content_view {"text"=>"content view 'test_cv'", "link"=>"/content_vie... | paused | error  | 2021/01/15 12:12:04 |          | admin | Task canceled, Task canceled, Task canceled
-------------------------------------|----------------------------------------------------------------------------------|--------|--------|---------------------|----------|-------|--------------------------------------------


2. # foreman-maintain health check --label foreman-tasks-not-paused
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Check for paused tasks:                                               [FAIL]
There are currently 1 paused tasks in the system
--------------------------------------------------------------------------------
There are multiple steps to proceed:
1) Resume paused tasks
2) Delete paused tasks
3) Investigate the tasks via UI
Select step to continue, [n(next)] 1
Resume paused tasks:
| Waiting 30 seconds for resumed tasks to start.                      [OK]
Total tasks found paused in error state: 50
Total tasks resumed:                     1
Resumed tasks:
 1) Task identifier: 4728cba4-8531-4a08-98ec-6ff8193db52f
    Task action:     Publish
    Task errors:     Task canceled, Task canceled, Task canceled
Total tasks failed to resume:            0
Failed tasks:

Total tasks skipped:                     49
Skipped tasks:
 1) Task identifier: 9818a1ae-b7dd-41c9-af27-90e03ff2564e
    Task action:     ForemanInventoryUpload::Async::GenerateAllReportsJob
 .
 .
 .
 49)Task identifier: d2f88925-abf6-4c5a-b7a6-99c991d32c17
    Task action:     Create RSS notifications
--------------------------------------------------------------------------------
Rerunning the check after fix procedure
Check for paused tasks:                                               [OK]
--------------------------------------------------------------------------------


Observation:
The above check was able to resume a paused task successfully, and the task of CV publish completed.

Comment 6 errata-xmlrpc 2021-04-21 14:48:24 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.9 Satellite Maintenance Release), 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-2021:1312