Bug 1331824 - Catalog item becomes corrupt after removing template it was using
Summary: Catalog item becomes corrupt after removing template it was using
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Provisioning
Version: 5.6.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.7.0
Assignee: Lucy Fu
QA Contact: Shveta
URL:
Whiteboard: catalog
Depends On:
Blocks: 1370481
TreeView+ depends on / blocked
 
Reported: 2016-04-29 16:34 UTC by Nandini Chandra
Modified: 2017-01-11 19:57 UTC (History)
5 users (show)

Fixed In Version: 5.7.0.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1370481 (view as bug list)
Environment:
Last Closed: 2017-01-11 19:57:05 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Nandini Chandra 2016-04-29 16:34:17 UTC
Description of problem:
-----------------------


Version-Release number of selected component (if applicable):
---------------------------------------
5.6.0.4 Beta 2


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



Steps to Reproduce:
------------------
1.Create a catalog item to provision an infra VM.
2.Remove the template that the catalog item was using from VMDB and refresh the infra provider.



Actual results:
---------------
Catalog item becomes corrupt.Unable to edit or view catalog item.


Expected results:
-----------------
When a template used by a catalog item is deleted,the catalog item should also be removed or put in some disabled state.


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

Comment 2 Nandini Chandra 2016-04-29 17:27:41 UTC
Here's a snippet from production.log when I click the catalog item :

[----] I, [2016-04-29T11:23:53.831412 #12716:11d64f0]  INFO -- : Processing by CatalogController#tree_select as JS
[----] I, [2016-04-29T11:23:53.831492 #12716:11d64f0]  INFO -- :   Parameters: {"id"=>"stc-1_st-1"}
[----] F, [2016-04-29T11:23:54.014052 #12716:11d64f0] FATAL -- : Error caught: [NoMethodError] undefined method `get_options' for nil:NilClass
/var/www/miq/vmdb/app/controllers/application_controller/miq_request_methods.rb:761:in `prov_set_show_vars'
/var/www/miq/vmdb/app/controllers/catalog_controller.rb:1737:in `get_node_info'
/var/www/miq/vmdb/app/controllers/catalog_controller.rb:1821:in `replace_right_cell'
/var/www/miq/vmdb/app/controllers/catalog_controller.rb:280:in `tree_select'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/abstract_controller/base.rb:181:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:126:in `call'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:126:in `call'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:455:in `call'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:455:in `call'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/callbacks.rb:90:in `run_callbacks'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/abstract_controller/callbacks.rb:19:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal/rescue.rb:31:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activesupport/lib/active_support/notifications.rb:164:in `instrument'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/activerecord/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/abstract_controller/base.rb:126:in `process'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionview/lib/action_view/rendering.rb:30:in `process'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal.rb:190:in `dispatch'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_controller/metal.rb:262:in `dispatch'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_dispatch/routing/route_set.rb:32:in `serve'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_dispatch/journey/router.rb:39:in `block in serve'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_dispatch/journey/router.rb:26:in `each'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_dispatch/journey/router.rb:26:in `serve'
/opt/rh/cfme-gemset/bundler/gems/rails-f0a2edc7fc08/actionpack/lib/action_dispatch/routing/route_set.rb:739:in `call'
/opt/rh/cfme-gemset/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
/opt/rh/cfme-gemset/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
/opt/rh/cfme-gemset/gems/omniauth-1.3.1/lib/omniauth/builder.rb:63: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.0.alpha/lib/rack/etag.rb:25:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.0.alpha/lib/rack/conditional_get.rb:38:in `call'
/opt/rh/cfme-gemset/gems/rack-2.0.0.alpha/lib/rack/head.rb:12:in `call'

Comment 3 Greg McCullough 2016-04-29 19:09:20 UTC
Drew - Lucy worked on issues around this before to deal with missing/orphaned and archived templates.  This seems to be a slightly different issue as we always had a request in those cases.  This one looks like the request is nil.

Would be good to recreate and maybe Lucy can help out here as well if needed.

Comment 4 Greg McCullough 2016-08-04 13:42:19 UTC
Lucy - Please retest.  Once we can edit the workflow we should look into not allowing invalid catalog items from being ordered in the UI.  Maybe the show but the UI button is disabled with a pop-up message.  Need to work with the UI team on that part.

Comment 6 CFME Bot 2016-08-16 20:35:50 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/ac42757c6afe4e995c0a3a4b8ca75f36f461b113

commit ac42757c6afe4e995c0a3a4b8ca75f36f461b113
Author:     Lucy Fu <lufu>
AuthorDate: Tue Aug 9 15:08:33 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue Aug 16 15:44:07 2016 -0400

    Update source in the provision request when source template is changed.
    
    The source column in the request is used to validate the template.
    During the request update time, options contains the old template while values has the new template id.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1331824

 app/models/miq_provision_virt_workflow.rb       |  2 +-
 spec/models/miq_provision_virt_workflow_spec.rb | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

Comment 7 CFME Bot 2016-08-16 20:35:54 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/b2d6852a444371437c6af2ac9e28c1f336c3902e

commit b2d6852a444371437c6af2ac9e28c1f336c3902e
Author:     Lucy Fu <lufu>
AuthorDate: Tue Aug 9 15:10:23 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue Aug 16 15:44:07 2016 -0400

    When validate template, check the existence of the request first.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1331824

 app/models/service_template.rb       | 8 ++++++++
 spec/models/service_template_spec.rb | 8 ++++++++
 2 files changed, 16 insertions(+)

Comment 8 CFME Bot 2016-08-16 20:35:59 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/ba69b49e4559285623b6ce0ea9986ca909757175

commit ba69b49e4559285623b6ce0ea9986ca909757175
Author:     Lucy Fu <lufu>
AuthorDate: Tue Aug 9 15:04:25 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue Aug 16 15:44:07 2016 -0400

    The provision request should not be deleted when a template is deleted.
    
    So the user can edit the catalog item to select a new template.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1331824

 app/models/vm_or_template.rb                       | 2 +-
 spec/models/miq_provision_request_template_spec.rb | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comment 10 CFME Bot 2016-08-30 16:10:46 UTC
New commit detected on ManageIQ/manageiq/darga:
https://github.com/ManageIQ/manageiq/commit/32ca30920fdf8113cf667d94e59011de854bf2b7

commit 32ca30920fdf8113cf667d94e59011de854bf2b7
Author:     Lucy Fu <lufu>
AuthorDate: Tue Aug 9 15:04:25 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Thu Aug 25 11:51:21 2016 -0400

    The provision request should not be deleted when a template is deleted.
    
    So the user can edit the catalog item to select a new template.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1331824

 app/models/vm_or_template.rb                       | 2 +-
 spec/models/miq_provision_request_template_spec.rb | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comment 11 CFME Bot 2016-08-30 16:10:53 UTC
New commit detected on ManageIQ/manageiq/darga:
https://github.com/ManageIQ/manageiq/commit/b140081d7c0c55d0f59f87d6cf5a1117a2c9d84e

commit b140081d7c0c55d0f59f87d6cf5a1117a2c9d84e
Author:     Lucy Fu <lufu>
AuthorDate: Tue Aug 9 15:08:33 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Thu Aug 25 11:52:51 2016 -0400

    Update source in the provision request when source template is changed.
    
    The source column in the request is used to validate the template.
    During the request update time, options contains the old template while values has the new template id.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1331824

 app/models/miq_provision_virt_workflow.rb       |  2 +-
 spec/models/miq_provision_virt_workflow_spec.rb | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

Comment 12 CFME Bot 2016-08-30 16:10:59 UTC
New commit detected on ManageIQ/manageiq/darga:
https://github.com/ManageIQ/manageiq/commit/753e46975f10adda9bbd89d1dbeb2efe1492ff5c

commit 753e46975f10adda9bbd89d1dbeb2efe1492ff5c
Author:     Lucy Fu <lufu>
AuthorDate: Tue Aug 9 15:10:23 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Thu Aug 25 11:53:13 2016 -0400

    When validate template, check the existence of the request first.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1331824

 app/models/service_template.rb       | 8 ++++++++
 spec/models/service_template_spec.rb | 8 ++++++++
 2 files changed, 16 insertions(+)

Comment 13 Shveta 2016-10-11 20:35:18 UTC
Fixed.
Verified in 5.7.0.4-alpha1.20161005153002_cfc8a23


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