Bug 1648499 - Task not marked as Finished while queuing service chargeback report through REST API
Summary: Task not marked as Finished while queuing service chargeback report through R...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.10.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.11.0
Assignee: Yuri Rudman
QA Contact: Nandini Chandra
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks: 1702660
TreeView+ depends on / blocked
 
Reported: 2018-11-09 23:35 UTC by Nandini Chandra
Modified: 2019-12-13 15:16 UTC (History)
8 users (show)

Fixed In Version: 5.11.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1702660 (view as bug list)
Environment:
Last Closed: 2019-12-13 15:16:30 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Nandini Chandra 2018-11-09 23:35:54 UTC
Description of problem:
-----------------------
I ran into this issue while verifying 

https://bugzilla.redhat.com/show_bug.cgi?id=1530952

Run the following command to queue/generate service chargeback report through REST API.

nachandr@unknown104A7DA2510C cfme_tests]$ curl "https://admin:smartvm@10.8.xx.yy/api/services/1" -k -X POST -H "Content-Type" -d '{"action": "queue_chargeback_report"}'
{"success":true,"message":"Queued chargeback report generation for Service id:1 name:'nan-cat-item'","task_id":"4","task_href":"https://10.8.xx.yy/api/tasks/138"}[nachandr@unknown104A7DA2510C cfme_tests]

The above request ends up creating 2 tasks - one to queue it and the other to actually generate the report, see below. However, the request returns the first (id 138) task that never gets set to "Finished". The second task (id 139) does get marked as "Finished"


irb(main):007:0> pp MiqTask.find(138)
#<MiqTask:0x000000000b6c13c0
 id: 138,
 name: "Generating chargeback report with id: 1",
 state: "Queued",
 status: "Ok",
 message: "Queueing Chargeback of Service with id: 1",
 userid: "system",
 created_on: Fri, 09 Nov 2018 13:59:03 UTC +00:00,
 updated_on: Fri, 09 Nov 2018 13:59:03 UTC +00:00,
 pct_complete: nil,
 context_data: nil,
 results: nil,
 miq_server_id: nil,
 identifier: nil,
 started_on: nil,
 zone: nil>

=> #<MiqTask id: 138, name: "Generating chargeback report with id: 1", state: "Queued", status: "Ok", message: "Queueing Chargeback of Service with id: 1", userid: "system", created_on: "2018-11-09 13:59:03", updated_on: "2018-11-09 13:59:03", pct_complete: nil, context_data: nil, results: nil, miq_server_id: nil, identifier: nil, started_on: nil, zone: nil>
irb(main):008:0> pp MiqTask.find(139)
#<MiqTask:0x000000000b6b13d0
 id: 139,
 name: "Generate Report: ''",
 state: "Finished",
 status: "Ok",
 message: "Generating report complete",
 userid: "admin",
 created_on: Fri, 09 Nov 2018 13:59:05 UTC +00:00,
 updated_on: Fri, 09 Nov 2018 13:59:07 UTC +00:00,
 pct_complete: nil,
 context_data: nil,
 results: nil,
 miq_server_id: 1,
 identifier: nil,
 started_on: Fri, 09 Nov 2018 13:59:05 UTC +00:00,
 zone: nil>


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


How reproducible:
----------------
Always


Steps to Reproduce:
-------------------
1.
2.
3.


Actual results:
---------------
Task created while queuing service chargeback report through REST API is not marked as Finished.


Expected results:
----------------
Task created while queuing service chargeback report through REST API should be marked as Finished.


Additional info:
---------------

Comment 3 CFME Bot 2019-03-15 18:41:08 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/10de8acde67333bf824289231f2a2fb0f65bc810
commit 10de8acde67333bf824289231f2a2fb0f65bc810
Author:     Yuri Rudman <yrudman>
AuthorDate: Mon Mar 11 12:17:23 2019 -0400
Commit:     Yuri Rudman <yrudman>
CommitDate: Mon Mar 11 12:17:23 2019 -0400

    pass miq_task_id and miq_callback when submitting job for generating chargeback for servcie. It will allow to initialize task's started_on column and to change task status Finished when queue item delivered.
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1648499

 app/models/service.rb | 16 +-
 1 file changed, 13 insertions(+), 3 deletions(-)

Comment 5 Nandini Chandra 2019-06-07 04:03:09 UTC
Verified in 5.11.05


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