Description of problem: While launching imported report based on Chargeback for Projects based on API. Version-Release number of selected component (if applicable): 5.7.2.1 How reproducible: Always Steps to Reproduce: 1- Choose an arbitrary report in the WebUI and test it to ensure it works. 2- Export this report as a YAML file through WebUI, convert it to JSON, and add extra sections so it looks like the example here : https://github.com/ManageIQ/manageiq_docs/blob/master/api/reference/reports.adoc 3- Import the JSON report through API with a curl POST command 4 - Try to launch a new report with this imported report Actual results: It failed with below exception: {"href":"https://10.74.130.103/api/tasks/4253000000002182","id":4253000000002182,"name":"Generate Report: 'cb_report'","state":"Finished","status":"Error","message":"undefined method `find' for ChargebackContainerProject:Class","userid":"system","created_on":"2017-05-30T09:10:00Z","updated_on":"2017-05-30T09:10:05Z"} Expected results: Report should be launched. Additional info: It is working for other reports but not for report based on Chargeback projects. Also find the text file which includes the related URLs that are hit and the corresponding output.
Created attachment 1283382 [details] importing and launching the report
Looking at the json I can see the in the conversion from yaml, ruby symbols in the the serialized hash "db_options" were converted to strings. However, the report generator is expecting symbols. This is what's causing the failure. I don't think it's possible to preserve symbols in json so the reporting conde may need to support both. I will need to investigate further.
https://github.com/ManageIQ/manageiq/pull/15273
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/ef760a7872ff28fef131ae582682ca8db0d4b8ea commit ef760a7872ff28fef131ae582682ca8db0d4b8ea Author: Gregg Tanzillo <gtanzill> AuthorDate: Thu Jun 1 13:59:27 2017 -0400 Commit: Gregg Tanzillo <gtanzill> CommitDate: Thu Jun 1 13:59:27 2017 -0400 Ensure report columns serialized as hashes have symbolized keys before importing This fixes a bug where a report imported via the Rest API, as json, fails to generate because the keys in columns serialized as hashes are received as strings. https://bugzilla.redhat.com/show_bug.cgi?id=1456742 app/models/miq_report/import_export.rb | 3 +++ spec/models/miq_report/import_export_spec.rb | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-)
As discussed with Greg on gitter, the two shared PR files, we need to apply changes only on one file i.e. import_export.rb not to the import_export_spec.rb file as this file is missing at downstream. Will test the changes as suggested by greg and will update the result accordingly. Regards, Neha Chugh
Verified in 5.9.0.13