Bug 1472973

Summary: VM: Error when clicking on archived or orphaned VMware VM in VM explorer
Product: Red Hat CloudForms Management Engine Reporter: Harpreet Kataria <hkataria>
Component: UI - OPSAssignee: Harpreet Kataria <hkataria>
Status: CLOSED CURRENTRELEASE QA Contact: Nikhil Dhandre <ndhandre>
Severity: high Docs Contact:
Priority: high    
Version: 5.8.0CC: akarol, dclarizi, hkataria, jhardy, mpovolny, obarenbo
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1479929 (view as bug list) Environment:
Last Closed: 2018-03-06 15:13:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1479929    

Description Harpreet Kataria 2017-07-19 17:22:25 UTC
Description of problem: Error when clicking on archived or orphaned VMware VM in VM explorer 


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


How reproducible: 100%


Steps to Reproduce:
1. Go Compute/Infrastructure/Virtual Machines
2. Click on Orphaned or Archived tree node in the tree
3. On the right click on any VMware VM

Actual results: Summary screen does not load, found error in the log:
F, [2017-07-19T12:34:42.270978 #17733] FATAL -- : Error caught: [ActiveRecord::RecordNotFound] Couldn't find ExtManagementSystem without an ID
/home/hkataria/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.4/lib/active_record/relation/finder_methods.rb:456:in `find_with_ids'
/home/hkataria/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.4/lib/active_record/relation/finder_methods.rb:66:in `find'
/home/hkataria/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.4/lib/active_record/querying.rb:3:in `find'
/home/hkataria/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.4/lib/active_record/core.rb:151:in `find'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/button/vm_console.rb:11:in `supported_vendor_api?'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/button/vm_vnc_console.rb:10:in `disabled?'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/button/basic.rb:50:in `calculate_properties'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:161:in `apply_common_props'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:81:in `toolbar_button'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:104:in `block in build_select_button'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:99:in `each'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:99:in `each_with_index'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:99:in `build_select_button'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:218:in `build_button'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:445:in `block (2 levels) in build_toolbar_from_class'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:444:in `each'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:444:in `block in build_toolbar_from_class'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:437:in `each'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:437:in `each_with_index'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:437:in `build_toolbar_from_class'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:19:in `build_toolbar'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper/toolbar_builder.rb:6:in `call'
/home/hkataria/dev/manageiq-ui-classic/app/helpers/application_helper.rb:512:in `build_toolbar'
/home/hkataria/dev/manageiq-ui-classic/app/controllers/vm_common.rb:1195:in `replace_right_cell'
/home/hkataria/dev/manageiq-ui-classic/app/controllers/vm_common.rb:968:in `tree_select'



Expected results: Should load VM summary screen


Additional info:

Comment 3 CFME Bot 2017-07-24 19:58:33 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:
https://github.com/ManageIQ/manageiq-ui-classic/commit/489b001ac208d4039934f402f6252aa8c94137e5

commit 489b001ac208d4039934f402f6252aa8c94137e5
Author:     Harpreet Kataria <hkataria>
AuthorDate: Wed Jul 19 16:18:23 2017 -0400
Commit:     Harpreet Kataria <hkataria>
CommitDate: Fri Jul 21 13:22:15 2017 -0400

    Added a ems_id existence check around VM VNC console button visibility
    
    calling 'api_version' for VM with ems_id as nil was throwing an error when accessing Archived/Orphaned vmware VM summary screen(Need to set Console type support is set to 'VNC')
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1472973

 app/helpers/application_helper/button/vm_console.rb        |  4 ++++
 app/helpers/application_helper/button/vm_vnc_console.rb    |  2 +-
 .../application_helper/buttons/vm_vnc_console_spec.rb      |  5 +++++
 .../examples_group/shared_examples_for_vm_console.rb       | 14 +++++++++++++-
 4 files changed, 23 insertions(+), 2 deletions(-)