Bug 1426029 - Cannot generate VM base report
Summary: Cannot generate VM base report
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Reporting
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.8.0
Assignee: Gregg Tanzillo
QA Contact: Jiri Stefanisin
URL:
Whiteboard: report
Depends On:
Blocks: 1426433
TreeView+ depends on / blocked
 
Reported: 2017-02-23 04:33 UTC by tachoi
Modified: 2020-05-14 15:40 UTC (History)
11 users (show)

Fixed In Version: 5.8.0.3
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1426433 (view as bug list)
Environment:
Last Closed: 2017-06-12 16:24:57 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description tachoi 2017-02-23 04:33:46 UTC
Description of problem:
Not able to generate VM based report, when select "Virtual Machines" or "VMs and Instances" from the "Configure Report Columns" it doesn't show "available Fields" but just stays blank.  Also, the previously generated "Virtual Machine" based reports are not able to edit, if i try to edit it, it does nothing.

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

How reproducible:
NA

Steps to Reproduce:
1. Go to "Cloud Intel" => "Reports" => "Configuration" => "Add a new report"
2. Select "Virtual Machine" from "Base the report on" options. 
3.

Actual results: in production.log
[----] I, [2017-02-22T12:52:21.356543 #4609:1269ed0]  INFO -- :   Parameters: {"chosen_model"=>"ManageIQ::Providers::InfraManager::Vm", "id"=>"new"}
[----] I, [2017-02-22T12:52:21.377861 #4609:1269ed0]  INFO -- :   Rendered layouts/_tabs.html.haml (1.2ms)
[----] I, [2017-02-22T12:52:21.378051 #4609:1269ed0]  INFO -- :   Rendered layouts/_flash_msg.html.haml (0.0ms)
[----] I, [2017-02-22T12:52:21.817622 #4609:1269ed0]  INFO -- :   Rendered report/_column_lists.html.haml (431.5ms)
[----] I, [2017-02-22T12:52:21.817755 #4609:1269ed0]  INFO -- :   Rendered report/_form_columns.html.haml (438.6ms)
[----] I, [2017-02-22T12:52:21.817817 #4609:1269ed0]  INFO -- :   Rendered report/_form.html.haml (448.3ms)
[----] F, [2017-02-22T12:52:21.818064 #4609:1269ed0] FATAL -- : Error caught: [ActionView::Template::Error] no implicit conversion of nil into String
/var/www/miq/vmdb/lib/miq_expression.rb:1153:in `+'
/var/www/miq/vmdb/lib/miq_expression.rb:1153:in `block in _custom_details_for'
/var/www/miq/vmdb/lib/miq_expression.rb:1152:in `each'
/var/www/miq/vmdb/lib/miq_expression.rb:1152:in `_custom_details_for'
/var/www/miq/vmdb/lib/miq_expression.rb:1130:in `model_details'
/var/www/miq/vmdb/lib/miq_expression.rb:1233:in `reporting_available_fields'
/var/www/miq/vmdb/app/views/report/_column_lists.html.haml:9:in `_app_views_report__column_lists_html_haml__976666618674444134_238076800'
/opt/rh/cfme-gemset/gems/actionview-5.0.0.1/lib/action_view/template.rb:158:in `block in render'
/opt/rh/cfme-gemset/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:166:in `instrument'
/opt/rh/cfme-gemset/gems/actionview-5.0.0.1/lib/action_view/template.rb:348:in `instrument'


Expected results: from production.log
[----] I, [2017-02-23T04:16:44.684011 #2811:17a11f0]  INFO -- :   Parameters: {"chosen_model"=>"ManageIQ::Providers::InfraManager::Vm", "id"=>"new"}
[----] I, [2017-02-23T04:16:44.731012 #2811:17a11f0]  INFO -- :   Rendered layouts/_tabs.html.haml (3.3ms)
[----] I, [2017-02-23T04:16:44.731453 #2811:17a11f0]  INFO -- :   Rendered layouts/_flash_msg.html.haml (0.1ms)
[----] I, [2017-02-23T04:16:48.901033 #2811:17a11f0]  INFO -- :   Rendered report/_column_lists.html.haml (4147.1ms)
[----] I, [2017-02-23T04:16:49.078848 #2811:17a11f0]  INFO -- :   Rendered report/_form_columns.html.haml (4344.6ms)
[----] I, [2017-02-23T04:16:49.081572 #2811:17a11f0]  INFO -- :   Rendered report/_form.html.haml (4373.7ms)
[----] I, [2017-02-23T04:16:49.144059 #2811:17a11f0]  INFO -- : Completed 200 OK in 4460ms (Views: 4435.0ms | ActiveRecord: 0.0ms)
[----] I, [2017-02-23T04:16:52.915868 #2825:16c9f5c]  INFO -- : Started GET "/api" for 127.0.0.1 at 2017-02-23 04:16:52 +0000
[----] I, [2017-02-23T04:16:52.919546 #2825:16c9f5c]  INFO -- : Processing by Api::ApiController#index as JSON
[----] I, [2017-02-23T04:16:52.957618 #2825:16c9f5c]  INFO -- : Completed 200 OK in 38ms (Views: 0.4ms | ActiveRecord: 0.0ms)

Additional info:
Possibly related to http://stackoverflow.com/questions/23940396/actionviewtemplateerror-no-implicit-conversion-of-nil-into-string

Comment 4 Felix Dewaleyne 2017-02-23 09:58:31 UTC
updating the severity to reflect the current status of the case

Comment 6 Gregg Tanzillo 2017-02-23 20:53:31 UTC
We've determined that the issue was caused by a custom attribute that has a nil value for its name. The code in reporting that generates the list of columns available to be included in a report looks at custom attributes and presents them as if they are real columns in the DB using the name. That code does not expect to fine a nil value for the name and it blows up.

Given that, we are planning on creating a hot fix for reporting to prevent blowing up on a nil custom attribute. That will enable the customer to create reports again. In addition to that we’ll want to have the customer delete any custom attributes like this and run a refresh to see if they come back. If the refresh fully completes the expectation is that they won’t.

To identify and delete the offending custom attributes please run the following commands from a rails console -

bin/rails c

# Identify custom attributes with nil names
CustomAttribute.where(:name => nil)
# Delete them
CustomAttribute.destroy_all(:name => nil)

After doing that, refresh all providers so that the custom attributes get regenerated. You can then run the first query to see if the any custom attributes were created again with nil names.

Comment 7 CFME Bot 2017-02-23 21:26:16 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/b18c5104f6dee66a2406687919ba5e5f4c84e7ec

commit b18c5104f6dee66a2406687919ba5e5f4c84e7ec
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Thu Feb 23 15:26:36 2017 -0500
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Thu Feb 23 15:39:01 2017 -0500

    Ignore custom attributes that have a nil name
    
    Fixes a bug where building reportable fields from custom attributes blows up when the name is nil.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1426029

 app/models/mixins/custom_attribute_mixin.rb |  2 +-
 spec/lib/miq_expression_spec.rb             | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)


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