Bug 1358598 - unexpected errors after adding infra provider
Summary: unexpected errors after adding infra provider
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.5.0
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: GA
: 5.5.5
Assignee: Joe Rafaniello
QA Contact: Nandini Chandra
URL:
Whiteboard: ui:provider:add
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-21 05:58 UTC by Nandini Chandra
Modified: 2016-08-12 18:47 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-26 15:37:26 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1488 normal SHIPPED_LIVE CFME 5.5.5 bug fixes and enhancement update 2016-07-26 19:28:27 UTC

Description Nandini Chandra 2016-07-21 05:58:26 UTC
Description of problem:
------------------------
UI blows up with this error message while adding a provider:

ERROR: syntax error at or near "{" LINE 1: SELECT COUNT({:conditions=>{:host_id=>[]}, :select=>"DISTINC... ^ [ems_infra/show_list]


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


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


Steps to Reproduce:
-------------------
1.Add a provider to CFME appliance


Actual results:
----------------
UI blows up while saving the provider.


Expected results:
----------------
It should be possible to add providers.


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

Comment 2 Nandini Chandra 2016-07-21 06:01:13 UTC
Snippet from production.log:


[----] I, [2016-07-21T01:49:56.041824 #11706:112d990]  INFO -- : Started GET "/ems_infra/show_list?
flash_msg=Infrastructure+Providers+%22vSphere+5.5%22+was+saved" for 127.0.0.1 at 2016-07-21 01:49:56 -0400

[----] I, [2016-07-21T01:49:56.044423 #11706:112d990]  INFO -- : Processing by EmsInfraController#show_list as HTML

[----] I, [2016-07-21T01:49:56.044541 #11706:112d990]  INFO -- :   Parameters: {"flash_msg"=>"Infrastructure Providers \"vSphere 5.5\" was saved"}

[----] F, [2016-07-21T01:49:56.188451 #11706:112d990] FATAL -- : Error caught: [PG::SyntaxError] ERROR:  syntax error at or near "{"
LINE 1: SELECT COUNT({:conditions=>{:host_id=>[]}, :select=>"DISTINC...
                     ^

/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `async_exec'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `block in exec_no_cache'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `exec_no_cache'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:584:in `execute_and_clear'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec_query'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/database_statements.rb:356:in `select'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `block in select_all'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/query_cache.rb:83:in `cache_sql'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `select_all'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/relation/calculations.rb:270:in `execute_simple_calculation'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/relation/calculations.rb:227:in `perform_calculation'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/relation/calculations.rb:133:in `calculate'
/var/www/miq/vmdb/lib/extensions/ar_virtual.rb:387:in `calculate_with_virtual'
/opt/rh/cfme-gemset/gems/activerecord-deprecated_finders-1.0.4/lib/active_record/deprecated_finders/relation.rb:84:in `calculate'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/relation/calculations.rb:48:in `count'
/opt/rh/cfme-gemset/gems/activerecord-4.2.7/lib/active_record/querying.rb:13:in `count'
/var/www/miq/vmdb/app/models/ext_management_system.rb:400:in `total_storages'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:656:in `block in build_get_attributes_with_options'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:652:in `each'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:652:in `build_get_attributes_with_options'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:638:in `build_reportable_data'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:378:in `block in build_table'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:377:in `collect'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:377:in `build_table'
/var/www/miq/vmdb/app/models/miq_report/search.rb:125:in `paged_view_search'
/var/www/miq/vmdb/app/controllers/application_controller.rb:1771:in `get_view'
/var/www/miq/vmdb/app/controllers/application_controller/ci_processing.rb:1018:in `process_show_list'
/var/www/miq/vmdb/app/controllers/ems_common.rb:261:in `show_list'
/opt/rh/cfme-gemset/gems/actionpack-4.2.7/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.7/lib/abstract_controller/base.rb:198:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.7/lib/action_controller/metal/rendering.rb:10:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.7/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/opt/rh/cfme-gemset/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'

Comment 3 Nandini Chandra 2016-07-21 06:23:58 UTC
This issue happens with infra providers only.Tested both vsphere and rhevm.

Just tried adding ec2 and I was able to add ec2.

Comment 4 Ronnie Rasouli 2016-07-21 08:10:09 UTC
Same issue appear with openstack infra provider.

The infra provider webpage appear with error.

 ERROR: syntax error at or near "{" LINE 1: SELECT COUNT({:conditions=>{:host_id=>[]}, :select=>"DISTINC... ^ [ems_infra/show_list]

Comment 5 Nandini Chandra 2016-07-21 13:00:49 UTC
I wanted to add that I can successfully add an infra provider and access all elements under it, but I cannot do the following since the UI blows up while accessing the Infrastructure->Providers page:

1)view the summary page of the newly added provider
2)add a second infra provider .

The provider elements were accessed through the Infrastructure tab.

Eg: Infrastructure->Virtual Machines, 
    Infrastructure->Hosts

Comment 7 Jeff Teehan 2016-07-21 17:01:58 UTC
Confirmed for SCVMM as well with same error.  Azure works fine.

Comment 8 Keenan Brock 2016-07-21 17:08:11 UTC
Hot potato - assigning to Joe ;)

https://gitlab.cloudforms.lab.eng.rdu2.redhat.com/cloudforms/cfme/merge_requests/1019

Comment 9 CFME Bot 2016-07-21 18:36:47 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=c91713397c152f7d1d52e35dd98967e187713297

commit c91713397c152f7d1d52e35dd98967e187713297
Merge: 4d35b18 c7fe877
Author:     Oleg Barenboim <obarenbo@redhat.com>
AuthorDate: Thu Jul 21 14:33:43 2016 -0400
Commit:     Oleg Barenboim <obarenbo@redhat.com>
CommitDate: Thu Jul 21 14:33:43 2016 -0400

    Merge branch 'lockdown_rails_4_2_6' into '5.5.z'
    
    Lockdown to rails 4.2.6 to workaround invalid SQL in 4.2.7
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1358598
    
    4.2.7 generates this invalid SQL:
    SELECT COUNT({:conditions=>{:host_id=>[4, 3, 2, 1]}, :select=>"DISTINCT storage_id"}) FROM "host_storages"
    
    The attached spec fails with 4.2.7 but passes on 4.2.6.
    
    More research is needed to get this test working on 4.2.7.
    
    Related:
    https://github.com/rails/rails/issues/20434
    https://github.com/rails/rails/pull/20450
    https://github.com/rails/rails/issues/25636
    
    See merge request !1019

 Gemfile                                   |  2 +-
 gems/pending/Gemfile                      |  4 ++--
 spec/models/ext_management_system_spec.rb | 20 ++++++++++++++++++++
 3 files changed, 23 insertions(+), 3 deletions(-)

Comment 10 CFME Bot 2016-07-21 18:36:52 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=c7fe877a3ce8155489c66e366a069dd80f6e7a1c

commit c7fe877a3ce8155489c66e366a069dd80f6e7a1c
Author:     Joe Rafaniello <jrafanie@redhat.com>
AuthorDate: Thu Jul 21 12:55:57 2016 -0400
Commit:     Joe Rafaniello <jrafanie@redhat.com>
CommitDate: Thu Jul 21 13:04:22 2016 -0400

    Lockdown to rails 4.2.6 to workaround invalid SQL in 4.2.7
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1358598
    
    4.2.7 generates this invalid SQL:
    SELECT COUNT({:conditions=>{:host_id=>[4, 3, 2, 1]}, :select=>"DISTINCT storage_id"}) FROM "host_storages"
    
    The attached spec fails with 4.2.7 but passes on 4.2.6.
    
    More research is needed to get this test working on 4.2.7.
    
    Related:
    https://github.com/rails/rails/issues/20434
    https://github.com/rails/rails/pull/20450
    https://github.com/rails/rails/issues/25636

 Gemfile                                   |  2 +-
 gems/pending/Gemfile                      |  4 ++--
 spec/models/ext_management_system_spec.rb | 20 ++++++++++++++++++++
 3 files changed, 23 insertions(+), 3 deletions(-)

Comment 12 Nandini Chandra 2016-07-25 12:35:46 UTC
Verified in 5.5.5.4

Comment 13 Ilanit Stein 2016-07-25 20:25:41 UTC
For cfme-5.5.5.4-1,
adding RHEVM-3.6.8-0.1 provider worked just fine.
also there was no error in evm/rhevm/production logs.

Comment 15 errata-xmlrpc 2016-07-26 15:37:26 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-2016-1488.html


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