Bug 1431107

Summary: it is hard (or there is no way at all) to cancel pending tasks from old remote execution job
Product: Red Hat Satellite Reporter: Jan Hutař <jhutar>
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.8CC: aruzicka, bbuckingham, egolov, inecas, jcallaha, ktordeur, lhellebr, peter.vreman, psuriset, will_darton
Target Milestone: UnspecifiedKeywords: Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: scale_lab
Fixed In Version: tfm-rubygem-foreman_remote_execution-1.3.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:43:38 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:
Bug Depends On:    
Bug Blocks: 1122832    

Description Jan Hutař 2017-03-10 12:12:27 UTC
Description of problem:
It is hard (or there is no way at all) to cancel pending tasks from old remote execution job.


Version-Release number of selected component (if applicable):
satellite-6.2.8-4.0.el7sat.noarch


How reproducible:
always


Steps to Reproduce:
1. Have clients managed by capsule
2. Start ReX job on the clients and white (some of) them are in pending,
   stop capsule
3. Now lets say we have just removed that capsule for good so we want to
   finish all the pending tasks from Satellite


Actual results:
You have to go to job -> Job Task -> Sub tasks, select one by one and click "Cancel". I have not found anything in Hammer or in API. Master task have "Cancel" button inactive. Dynflow console does not have "cancel" or "skip" links.


Expected results:
There should be a way (ideally in all webUI, API and hammer) to cancel tasks of a given job (you can say this via task search query "parent_task_id = ...").


Additional info:
This is error I see in the child task before clicking "Cancel":

Error loading data from Capsule: RestClient::ResourceNotFound - 404 Resource Not Found

When I click "Cancel", this appears and after some time 3 more messages appears and then finally child task is completed:

Initialization error: RestClient::InternalServerError - 500 Internal Server Error

Comment 5 Adam Ruzicka 2017-06-06 11:00:35 UTC
Created redmine issue http://projects.theforeman.org/issues/19937 from this bug

Comment 6 Satellite Program 2017-07-13 14:15:32 UTC
Upstream bug assigned to aruzicka

Comment 7 Satellite Program 2017-07-13 14:15:36 UTC
Upstream bug assigned to aruzicka

Comment 8 Satellite Program 2017-08-03 16:15:10 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/19937 has been resolved.

Comment 9 Ivan Necas 2017-09-14 08:16:29 UTC
*** Bug 1422466 has been marked as a duplicate of this bug. ***

Comment 10 Lukáš Hellebrandt 2017-12-19 14:04:22 UTC
I would expect the subcommands Cancel and Abort in 'hammer job-invocation' but they are not there, tested with snap 29:

# hammer job-invocation --help
Usage:
    hammer job-invocation [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:
 SUBCOMMAND                    subcommand
 [ARG] ...                     subcommand arguments

Subcommands:
 create                        Create a job invocation
 info                          Show job invocation
 list                          List job invocations
 output                        View the output for a host

Options:
 -h, --help                    print help

# hammer --version
hammer (0.11.0.1)
 * hammer_cli_csv (unknown version)
 * hammer_cli_foreman (0.11.0.5)
 * hammer_cli_foreman_admin (0.0.7)
 * hammer_cli_foreman_bootdisk (0.1.3.3)
 * hammer_cli_foreman_discovery (1.0.0)
 * hammer_cli_foreman_docker (unknown version)
 * hammer_cli_foreman_openscap (unknown version)
 * hammer_cli_foreman_remote_execution (unknown version)
 * hammer_cli_foreman_tasks (unknown version)
 * hammer_cli_foreman_virt_who_configure (unknown version)
 * hammer_cli_katello (0.11.3.4)

Comment 11 Adam Ruzicka 2018-01-02 11:18:33 UTC
This bug wasn't about being or not being able to do hammer job-invocation cancel --id $id. That is covered in another BZ[1].

This BZ was about how under certain conditions a REX job could get stuck in pending and clicking the cancel button would do nothing. The fix for this BZ addresses this situation and makes the cancel button work even in that case.

I'm moving this to ON_QA once more. Please take a look at it again.

[1] - https://bugzilla.redhat.com/show_bug.cgi?id=1465521

Comment 12 Lukáš Hellebrandt 2018-01-02 12:51:40 UTC
In that case, I am verifying that the Cancel button actually cancels the pending jobs. Note that is something different than what is proposed in OP. Used Sat6.3 snap 29.

Used reproducer from OP. Cancelling the job takes some time (~minute) but works.

Comment 13 Bryan Kearney 2018-02-21 16:40:56 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, 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/RHSA-2018:0336

Comment 14 Bryan Kearney 2018-02-21 16:43:38 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, 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/RHSA-2018:0336

Comment 15 Satellite Program 2018-02-21 16:54:37 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, 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/RHSA-2018:0336