Bug 1439144 - Error "undefined method `name' for nil:NilClass" when clicked on catalog item after deleting the repository.
Summary: Error "undefined method `name' for nil:NilClass" when clicked on catalog ite...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: 5.9.0
Assignee: Harpreet Kataria
QA Contact: Pavol Kotvan
URL:
Whiteboard: ansible:repo:ui:error
Depends On:
Blocks: 1439948
TreeView+ depends on / blocked
 
Reported: 2017-04-05 10:35 UTC by Aziza Karol
Modified: 2018-03-29 15:05 UTC (History)
5 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1439948 (view as bug list)
Environment:
Last Closed: 2018-03-06 15:45:10 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Aziza Karol 2017-04-05 10:35:28 UTC
Description of problem:


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

How reproducible:
100%


Steps to Reproduce:
1. Enable Embedded Ansible role.
2. Wait until it will be enabled.
3. Add some repository with ansible playbook.
4. Navigate to Services/Catalogs/Catalog Items.
5. Create ansible catalog item and order
6. delete the repository which is in use by catalog item
7. Again Navigate to Services/Catalogs/Catalog Items.
8  click on the catalog item in accordion.

Actual results:
undefined method `name' for nil:NilClass in displayed in production.log

Expected results:


Additional info:

production.log
[----] I, [2017-04-05T06:12:32.774741 #2986:b73a2c]  INFO -- : Started POST "/catalog/tree_select/?id=stc-1_st-1" for 127.0.0.1 at 2017-04-05 06:12:32 -0400
[----] I, [2017-04-05T06:12:32.777561 #2986:b73a2c]  INFO -- : Processing by CatalogController#tree_select as JS
[----] I, [2017-04-05T06:12:32.777670 #2986:b73a2c]  INFO -- :   Parameters: {"id"=>"stc-1_st-1"}
[----] I, [2017-04-05T06:12:32.850768 #2986:b73a2c]  INFO -- :   Rendered /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-907ff1db185b/app/views/layouts/_flash_msg.html.haml (0.1ms)
[----] I, [2017-04-05T06:12:32.855103 #2986:b73a2c]  INFO -- :   Rendered /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-907ff1db185b/app/views/catalog/_svccat_tree_show.html.haml (23.1ms)
[----] I, [2017-04-05T06:12:32.860184 #2986:b73a2c]  INFO -- : Completed 200 OK in 82ms (Views: 1.5ms | ActiveRecord: 3.0ms)
[----] I, [2017-04-05T06:12:35.424867 #2986:b6c36c]  INFO -- : Started POST "/catalog/accordion_select?id=sandt_accord" for 127.0.0.1 at 2017-04-05 06:12:35 -0400
[----] I, [2017-04-05T06:12:35.427721 #2986:b6c36c]  INFO -- : Processing by CatalogController#accordion_select as JS
[----] I, [2017-04-05T06:12:35.427787 #2986:b6c36c]  INFO -- :   Parameters: {"id"=>"sandt_accord"}
[----] F, [2017-04-05T06:12:35.509075 #2986:b6c36c] FATAL -- : Error caught: [NoMethodError] undefined method `name' for nil:NilClass
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-907ff1db185b/app/controllers/catalog_controller.rb:1789:in `fetch_playbook_details'
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-907ff1db185b/app/controllers/catalog_controller.rb:1949:in `replace_right_cell'
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-907ff1db185b/app/controllers/application_controller/explorer.rb:166:in `accordion_select'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/abstract_controller/base.rb:188:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:126:in `call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:455:in `call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:90:in `run_callbacks'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/abstract_controller/callbacks.rb:19:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal/rescue.rb:20:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/notifications.rb:164:in `instrument'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
/opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/abstract_controller/base.rb:126:in `process'
/opt/rh/cfme-gemset/gems/actionview-5.0.2/lib/action_view/rendering.rb:30:in `process'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal.rb:190:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_controller/metal.rb:262:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/routing/route_set.rb:32:in `serve'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/journey/router.rb:39:in `block in serve'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/journey/router.rb:26:in `each'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/journey/router.rb:26:in `serve'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/routing/route_set.rb:725:in `call'
/opt/rh/cfme-gemset/gems/secure_headers-3.0.3/lib/secure_headers/middleware.rb:10:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/etag.rb:25:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/conditional_get.rb:38:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:222:in `context'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:216:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/cookies.rb:613:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/callbacks.rb:90:in `run_callbacks'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/rack/logger.rb:36:in `call_app'
/opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/rack/logger.rb:26:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/request_id.rb:24:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
/opt/rh/cfme-gemset/gems/activesupport-5.0.2/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/opt/rh/cfme-gemset/gems/actionpack-5.0.2/lib/action_dispatch/middleware/executor.rb:12:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
/opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/engine.rb:522:in `call'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/configuration.rb:224:in `call'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/server.rb:561:in `handle_request'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/server.rb:406:in `process_client'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/server.rb:271:in `block in run'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/puma-3.3.0/lib/puma/thread_pool.rb:111:in `block in spawn_thread'
[----] I, [2017-04-05T06:12:35.531274 #2986:b6c36c]  INFO -- :   Rendered /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-907ff1db185b/app/views/layouts/_exception_contents.html.haml (16.8ms)

Comment 2 Harpreet Kataria 2017-04-06 16:52:38 UTC
https://github.com/ManageIQ/manageiq-ui-classic/pull/946

Comment 3 CFME Bot 2017-04-06 17:28:24 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:
https://github.com/ManageIQ/manageiq-ui-classic/commit/98c0cde49cd8d2e8d2a52c3648848c6e2a743d65

commit 98c0cde49cd8d2e8d2a52c3648848c6e2a743d65
Author:     Harpreet Kataria <hkataria>
AuthorDate: Thu Apr 6 12:50:04 2017 -0400
Commit:     Harpreet Kataria <hkataria>
CommitDate: Thu Apr 6 13:05:44 2017 -0400

    Made changes to code to only access name if record exists.
    
    Ansible objects selected when adding Catalog Item could have been deleted from database so need to check for their existence before accessing their names to be displayed on summary screen.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1439144

 app/controllers/catalog_controller.rb        | 25 ++++++++++-------
 app/views/catalog/_sandt_tree_show.html.haml | 19 +++++++------
 spec/controllers/catalog_controller_spec.rb  | 42 ++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+), 19 deletions(-)


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