Bug 1174615 - [CLI] bkr job-cancel will can cancel a Task if I give a invalid task number
Summary: [CLI] bkr job-cancel will can cancel a Task if I give a invalid task number
Alias: None
Product: Beaker
Classification: Community
Component: command line   
(Show other bugs)
Version: 19
Hardware: Unspecified
OS: Unspecified
low vote
Target Milestone: 24.0
Assignee: wangdong
QA Contact: tools-bugs
Keywords: Patch, Triaged
Depends On:
TreeView+ depends on / blocked
Reported: 2014-12-16 06:16 UTC by wangdong
Modified: 2018-02-06 00:41 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-02-21 18:48:21 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description wangdong 2014-12-16 06:16:09 UTC
Description of problem:
In my test, If I cancel a task with invalid task NO. it will also successful complete.

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

How reproducible:

Steps to Reproduce:
1.Create a job and wait it in running status. Suppose there is a task NO. T:123456

2. Cancel this task like this "bkr job-cancel T:123456qwe"


Actual results:
This job can be canceled successful complete.

Expected results:
It should return "XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:Invalid T 123456qwe"

Additional info:
Also can we add we can cancel Task in "bkr job-cancel" command. From now if I type this command --> "bkr job-cancel --help"

It will return 
[wangdong@localhost ~]$ bkr job-cancel --help
Usage: bkr job-cancel [options] [J:<id> | RS:<id> ...]

  --hub=URL            Connect to Beaker server at URL (overrides config file)
  --username=USERNAME  Use USERNAME for password authentication (overrides config file)
  --password=PASSWORD  Use PASSWORD for password authentication (overrides config file)
  --version            show program's version number and exit
  -h, --help           show this help message and exit
  --msg=MSG            Optional message to record as to why you cancelled
I think we can tip user it can cancel a task.

Comment 1 Roman Joost 2016-09-15 07:24:40 UTC
Dear Wang Dong,

I've tried to reproduce this problem today, but get:

$ bkr job-cancel T:283829393
XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:Invalid T 283829393

where T:283829393 is a task which doesn't exist. Do you still have this problem?

Comment 2 wangdong 2016-10-13 06:49:24 UTC
Dear Roman

After my reproduce it again.

Run command:
[dowang@dhcp-136-186 ~]$ bkr job-cancel T:99999q
Cancelled T:99999q

Capture in server-debug.log:
Oct 13 05:56:44 beaker-devel.app.eng.bos.redhat.com beaker-server[11324]: [error] /usr/lib64/python2.6/site-packages/sqlalchemy/engine/default.py:324: Warning: Truncated incorrect DOUBLE value: '99999q'
Oct 13 05:56:44 beaker-devel.app.eng.bos.redhat.com beaker-server[11324]: [error]   cursor.execute(statement, parameters)
Oct 13 05:56:44 beaker-devel.app.eng.bos.redhat.com beaker-server[11324]: bkr.server.xmlrpccontroller DEBUG Time: 0:00:00.030048 taskactions.stop ('T:99999q', 'cancel', None)

In above test Beaker throw a error can't handle DOUBLE value

But in below test I found make job-cancel can't handle Task ID contains letter
[dowang@dhcp-136-186 ~]$ bkr job-cancel T:139203
Cancelled T:139203
[dowang@dhcp-136-186 ~]$ bkr job-cancel T:139206
XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:Invalid T 139206
[dowang@dhcp-136-186 ~]$ bkr job-cancel T:139203w
Cancelled T:139203w
[dowang@dhcp-136-186 ~]$ bkr job-cancel T:w139203
XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:Invalid T w139203
[dowang@dhcp-136-186 ~]$ bkr job-cancel T:1w39203
Cancelled T:1w39203

I will try to hanle this bug.

Comment 3 Blake McIvor 2016-10-17 23:00:05 UTC
I managed to reproduce this bug.

You may have also not noticed that upon completing the steps described for example

$ bkr job-cancel T:99999q
Cancelled T:99999q

if you run the exact command again, and the T has been cancelled (and is displaying in the webUI as cancelled) you get

$ bkr job-cancel T:99999q
Cancelled T:99999q

Surely it should report that the task no longer exists.

Comment 4 wangdong 2016-10-18 02:19:32 UTC
On Gerrit:

Comment 7 wangdong 2017-01-03 07:30:06 UTC
on gerrit:

Comment 9 Hui Wang 2017-01-12 02:11:45 UTC
Verified this issue.
The result is PASS.
Version: Beaker 24.0.git.241.4eb2414 
$ bkr job-cancel T:9q9999q
XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:Invalid T 9q9999q

Comment 10 Dan Callaghan 2017-02-21 18:48:21 UTC
Beaker 24.0 has been released.

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