Bug 1623607

Summary: [RFE] Automating the generation of widget content Via RESTAPI
Product: Red Hat CloudForms Management Engine Reporter: Joe Wood <jowood>
Component: APIAssignee: drew uhlmann <duhlmann>
Status: CLOSED NOTABUG QA Contact: Parthvi Vala <pvala>
Severity: low Docs Contact:
Priority: medium    
Version: 5.7.0CC: dmetzger, duhlmann, gmccullo, gtanzill, JAyissi, jocarter, lavenel, obarenbo, pvala, simaishi, smallamp, tfitzger
Target Milestone: GAKeywords: FutureFeature, RFE, TestOnly, ZStream
Target Release: 5.12.0Flags: mfeifer: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1753682 1767837 (view as bug list) Environment:
Last Closed: 2020-03-20 15:36:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1753682, 1767837    

Description Joe Wood 2018-08-29 17:53:53 UTC
This is a companion bug to 1445932, created at the direction of Greg McCullough on 2018-08-29 13:27:25 EDT

Description of problem:
Currently, widgets are generated based on a schedule set per widget (with a minimum of 1 hour wait). I would like to be able to trigger the generation of a widget content from REST API. 

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

How reproducible:
Always

Steps to Reproduce:
1. Create a widget (default update is every hour)

Actual results:
Manual generation of widget content is possible or you will have to wait for an hour before the widget gets generated.

Expected results:
I should be able to trigger a refresh from automate or REST API.

Additional info:
A workaround is to call rails command in automate with a method like:

#
# Description: generate widget content by calling shell command
#

cmd = "/var/www/miq/vmdb/bin/rails r 'MiqWidget.find_by_title(\"Migration Candidates\").queue_generate_content'"
system(cmd)

exit MIQ_OK

Comment 3 drew uhlmann 2019-08-22 13:53:09 UTC
Hey Johnny, I'm looking into this.

Comment 4 drew uhlmann 2019-08-22 14:04:18 UTC
The PR in https://bugzilla.redhat.com/show_bug.cgi?id=1445932 satisfies the use case for this ticket.

The preferred route for the use case was an Automate action, not API functionality, and since the Automate enhancement is merged, I don't know what's needed here. 

Could someone clarify what else is needed for this ticket, please?

Comment 5 Greg McCullough 2019-08-23 20:19:00 UTC
I think PM (Loic) is the right person to ask for clarification, but this looks like just assigning out API RFEs.  Having it in Automate does not preclude it from being added to the API.  

Maybe just a question if priority as it relates to getting it into the 5.10.10 release.

Comment 8 drew uhlmann 2019-08-26 15:55:04 UTC
Does someone want to go give the PR a spin, based off https://github.com/ManageIQ/manageiq-api/pull/660#issuecomment-524914969 please? 

Joe or Johnny or anyone, please?

Comment 10 drew uhlmann 2019-08-26 18:56:44 UTC
Thanks for the info!

Comment 11 drew uhlmann 2019-08-29 13:38:23 UTC
Changed target release per comment seven, please don't yell at me.

Comment 12 CFME Bot 2019-08-29 14:01:36 UTC
New commit detected on ManageIQ/manageiq-api/master:

https://github.com/ManageIQ/manageiq-api/commit/c47021de3a7d1535c58b190497defccf5800c9f3
commit c47021de3a7d1535c58b190497defccf5800c9f3
Author:     d-m-u <drewuhlmann>
AuthorDate: Sun Aug 25 19:25:58 2019 -0400
Commit:     d-m-u <drewuhlmann>
CommitDate: Sun Aug 25 19:25:58 2019 -0400

    Add widgets endpoints

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

 app/controllers/api/widgets_controller.rb | 25 +
 config/api.yml | 24 +
 spec/requests/widgets_spec.rb | 100 +
 3 files changed, 149 insertions(+)

Comment 15 Satoe Imaishi 2019-10-01 21:18:05 UTC
Also need https://github.com/ManageIQ/manageiq-api/pull/679