Bug 1146178 - Can not run reports based on Cloud Provider child models that reference parent fields
Summary: Can not run reports based on Cloud Provider child models that reference paren...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.3.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: GA
: 5.4.0
Assignee: Jason Frey
QA Contact: Nandini Chandra
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-24 16:45 UTC by Dan Clarizio
Modified: 2015-06-16 12:40 UTC (History)
6 users (show)

Fixed In Version: 5.4.0.0.11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-16 12:40:14 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Simple Flavor report that causes the exception (39.26 KB, image/png)
2014-09-24 16:45 UTC, Dan Clarizio
no flags Details
Adding a new report (62.49 KB, image/png)
2015-03-05 20:02 UTC, Bill Wei
no flags Details
editing an existing report (63.43 KB, image/png)
2015-03-05 20:06 UTC, Bill Wei
no flags Details
Report result (30.81 KB, image/png)
2015-03-05 20:10 UTC, Bill Wei
no flags Details
Define an advance search (51.25 KB, image/png)
2015-03-05 20:13 UTC, Bill Wei
no flags Details
After advance search is defined (32.45 KB, image/png)
2015-03-05 20:15 UTC, Bill Wei
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1100 0 normal SHIPPED_LIVE CFME 5.4.0 bug fixes, and enhancement update 2015-06-16 16:28:42 UTC

Description Dan Clarizio 2014-09-24 16:45:04 UTC
Created attachment 940832 [details]
Simple Flavor report that causes the exception

Description of problem:
Running a report based on a Cloud Provider child model (i.e. Availability Zone, Flavor, etc) that references a parent Cloud Provider field (i.e. Cloud Provider: Name) results in an exception.

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

Steps to Reproduce:
1. Create a report based on Flavor, select Name and Cloud Provider: Name fields
2. Run the report
3. Exception screen is displayed in the UI with stack trace in the log

Actual results:
Exception

Expected results:
Report runs to completion with proper values shown

Additional info:
This is a result of the fixes for https://bugzilla.redhat.com/show_bug.cgi?id=1141319, which was added for the 5.3.0 release, but exposed this issue due to the subclassing of the EMS models for cloud.  More details can be found in the PR here as well: https://github.com/ManageIQ/manageiq/pull/585

Top of stack trace:
[----] I, [2014-09-24T16:40:52.306978 #701:f39ff8]  INFO -- : Started POST "/report/x_button/23000000000130?pressed=miq_report_run" for 127.0.0.1 at 2014-09-24 09:40:52 -0700
[----] I, [2014-09-24T16:40:52.328978 #701:f39ff8]  INFO -- : Processing by ReportController#x_button as JS
[----] I, [2014-09-24T16:40:52.329070 #701:f39ff8]  INFO -- :   Parameters: {"pressed"=>"miq_report_run", "id"=>"23000000000130"}
[----] F, [2014-09-24T16:40:52.591663 #701:f39ff8] FATAL -- : Error caught: [ActiveRecord::ConfigurationError] Association named 'ems_cloud' was not found; perhaps you misspelled it?
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:150:in `block in records_by_reflection'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:146:in `each'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:146:in `group_by'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:146:in `records_by_reflection'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:139:in `grouped_records'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:130:in `preload_one'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:109:in `preload'
/home/dclarizio/dev/manageiq/vmdb/lib/extensions/ar_virtual.rb:310:in `preload_with_virtual'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:98:in `block in run'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:98:in `each'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:98:in `run'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:117:in `block in preload_hash'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:116:in `each'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:116:in `preload_hash'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:107:in `preload'
/home/dclarizio/dev/manageiq/vmdb/lib/extensions/ar_virtual.rb:310:in `preload_with_virtual'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:98:in `block in run'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:98:in `each'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/associations/preloader.rb:98:in `run'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation.rb:181:in `block in exec_queries'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation.rb:180:in `each'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation.rb:180:in `exec_queries'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation.rb:160:in `block in to_a'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/explain.rb:33:in `logging_query_plan'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation.rb:159:in `to_a'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation/finder_methods.rb:159:in `all'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation/finder_methods.rb:105:in `find'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/relation/finder_methods.rb:101:in `find'
/home/dclarizio/.rvm/gems/ruby-1.9.3-p547/bundler/gems/rails-8cf411ee95e7/activerecord/lib/active_record/querying.rb:5:in `find'
/home/dclarizio/dev/manageiq/vmdb/app/models/rbac.rb:449:in `method_with_scope'
/home/dclarizio/dev/manageiq/vmdb/app/models/rbac.rb:252:in `find_targets_without_rbac'
/home/dclarizio/dev/manageiq/vmdb/app/models/rbac.rb:248:in `find_targets_with_rbac'
/home/dclarizio/dev/manageiq/vmdb/app/models/rbac.rb:410:in `search'
/home/dclarizio/dev/manageiq/vmdb/app/models/miq_report/generator.rb:269:in `_generate_table'

Comment 2 Jason Frey 2014-11-04 20:08:55 UTC
I've made this bug public so I can share on talk.manageiq.org.

Comment 3 CFME Bot 2015-02-19 22:15:46 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/7c67212b7c181aae08967b1e2704dfd61960dd2e

commit 7c67212b7c181aae08967b1e2704dfd61960dd2e
Author:     Bill Wei <bilwei>
AuthorDate: Fri Feb 6 15:48:26 2015 -0500
Commit:     Bill Wei <bilwei>
CommitDate: Sat Feb 14 17:15:14 2015 -0500

    Distinguish class path and association path
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1146178

 vmdb/app/models/miq_expression.rb                  | 49 ++++++++++++----------
 vmdb/config/locales/en.yml                         |  1 +
 .../models/miq_expression/model_details_spec.rb    | 31 ++++++++++----
 3 files changed, 52 insertions(+), 29 deletions(-)

Comment 6 Bill Wei 2015-03-05 20:02:49 UTC
Created attachment 998533 [details]
Adding a new report

Selection "Provider Name" is more specific when add a new report

Comment 7 Bill Wei 2015-03-05 20:06:22 UTC
Created attachment 998536 [details]
editing an existing report

When edit the same report, the selection "Cloud Provider Name" becomes more generic "Cloud/Infrastructure Provider Name"

Comment 8 Bill Wei 2015-03-05 20:08:48 UTC
I meant selection "Cloud Provider: Name"
(In reply to Bill Wei from comment #6)
> Created attachment 998533 [details]
> Adding a new report
> 
> Selection "Provider Name" is more specific when add a new report

Comment 9 Bill Wei 2015-03-05 20:10:37 UTC
Created attachment 998538 [details]
Report result

The report runs successfully, with correct column name "Cloud Provider Name"

Comment 10 Bill Wei 2015-03-05 20:13:27 UTC
Created attachment 998540 [details]
Define an advance search

Similar problem with advance search. When define an advanced search, the selection "Cloud Provider: Name"

Comment 11 Bill Wei 2015-03-05 20:15:04 UTC
Created attachment 998541 [details]
After advance search is defined

After advance search is defined, the selection shows as "Cloud/Infrastructure Provider: Name"

Comment 12 Bill Wei 2015-03-05 20:17:32 UTC
With the fix, the report runs correctly without an issue. There are some minor UI displaying issues. Attachments were created above.

Comment 14 Nandini Chandra 2015-04-11 02:44:56 UTC
Verified in 5.4.0.0.11

Comment 16 errata-xmlrpc 2015-06-16 12:40:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1100.html


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