Bug 1162355

Summary: [UI] Undefined Method Error trying to edit Dashboard Widget
Product: Red Hat CloudForms Management Engine Reporter: Jared Deubel <jdeubel>
Component: UI - OPSAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED WONTFIX QA Contact: Dave Johnson <dajohnso>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2.0CC: clasohm, jdeubel, jocarter, nlane
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
bz_monday 020215
Last Closed: 2015-12-14 14:27:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1110527    

Description Jared Deubel 2014-11-10 22:04:16 UTC
Description of problem:
We have a dashboard widget called Quick Links which shows "Error" in the Status column under Cloud Intelligence - Reports - Dashboard Widgets.

When I look at the widget through Cloud Intelligence - Reports - Dashboard Widgets, I can see that it contains two menu shortcuts:

Services / My Services
Services / Catalogs

Visibility is by role, with the following user roles: EvmRole-super_administrator, Operations_administrator, Project_user, Service_delivery, Super_administrator

But when I create a new widget with the same shortcuts, it works perfectly fine.

One thing that I forgot to mention is that when a user adds the widget to his dashboard, it says "No shortcuts are authorized for this user, contact your Administrator . . . ". Even though I am logged in as "admin".


When we click on the widget and select Edit this Widget from the Configuration menu, we get the following error:
====================================
[----] I, [2014-11-10T21:34:47.283977 #14444:441808]  INFO -- : Processing by ReportController#x_button as JS
[----] I, [2014-11-10T21:34:47.284054 #14444:441808]  INFO -- :   Parameters: {"pressed"=>"widget_edit", "id"=>"999000000000013"}
[----] F, [2014-11-10T21:34:47.323417 #14444:441808] FATAL -- : Error caught: [NoMethodError] undefined method `id' for nil:NilClass
/var/www/miq/vmdb/app/controllers/report_controller/widgets.rb:414:in `block in widget_set_form_vars'
/var/www/miq/vmdb/app/controllers/report_controller/widgets.rb:414:in `each'
/var/www/miq/vmdb/app/controllers/report_controller/widgets.rb:414:in `widget_set_form_vars'
/var/www/miq/vmdb/app/controllers/report_controller/widgets.rb:88:in `widget_edit'
/var/www/miq/vmdb/app/controllers/report_controller.rb:69:in `x_button'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:458:in `_run__358622117577052205__process_action__4478254990294462165__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in `invalidate'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in `call!'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/conditionalget.rb:35:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__1085434538997024779__call__3880020392026328476__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/rack/logger.rb:18:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/connection.rb:80:in `block in pre_process'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/connection.rb:78:in `catch'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/connection.rb:78:in `pre_process'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/connection.rb:53:in `process'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/connection.rb:38:in `receive_data'
/opt/rh/ruby193/root/usr/share/gems/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
/opt/rh/ruby193/root/usr/share/gems/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start'
/opt/rh/ruby193/root/usr/share/gems/gems/thin-1.3.1/lib/thin/server.rb:159:in `start'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/handler/thin.rb:13:in `run'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'

====================================

Version-Release number of selected component (if applicable):
5.2.4.2-20140624123535_1fc9d69

Comment 4 Milan Zázrivec 2015-02-03 11:00:45 UTC
I tried to reproduce this problem without success.

From analyzing the 5.2 code & the error log posted above, the problem
shows when our application lists widget shortcuts for a particular
menu - type widget.

We're looking at the following type of db association:

one miq_widget -> several miq_widget_shortcuts <- several miq_shortcuts

i.e. miq_widget_shortcuts here is a binding table between two tables
(widget & shortcuts) and the above error happens b/c one of
the binding rows in miq_widget_shortcuts has its id value set to null.

This is quite strange and in theory should never happen, since the id column
here should be filled automatically from a sequence.

My guess is that this is most likely a low-level rails bug and I cannot
offer a better answer, not unless there's a customer (reproducing) database
available for me to look at, or perhaps logs from the CFME application
showing a problem with the widget in question.

Thanks.

Comment 6 Milan Zázrivec 2015-12-14 14:27:30 UTC
Since the associated customer case has been closed, I'm closing this report
for now.

Please reopen if any further information shows up.

Thank you.