Bug 1399027

Summary: Error: Undefined method 'redirect_url' when service dialog submitted from a button on a cloud provider
Product: Red Hat CloudForms Management Engine Reporter: Shane Boulden <sboulden>
Component: UI - OPSAssignee: Martin Hradil <mhradil>
Status: CLOSED DUPLICATE QA Contact: Dave Johnson <dajohnso>
Severity: medium Docs Contact:
Priority: high    
Version: 5.6.0CC: hkataria, jhardy, mkanoor, mpovolny, obarenbo, sboulden, tfitzger
Target Milestone: GA   
Target Release: cfme-future   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-11 10:33:20 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:
Attachments:
Description Flags
Undefined method error encountered none

Description Shane Boulden 2016-11-28 05:34:42 UTC
Created attachment 1225112 [details]
Undefined method error encountered

Description of problem:
An error "undefined method redirect_url" is encountered when a service dialog is submitted. The service dialog was instantiated from a button on a cloud provider.

The state machine that the button references is still called correctly.

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

How reproducible:
Every time.

Steps to Reproduce:
1. Create a service dialog with "submit" and "cancel" options
2. Create a button group for the "provider" category  
3. Create a button, and assign it to the button group created in (2)
a. Use the service dialog created in (1)
b. Use the Call_Instance request to instantiate a state machine
4. Save the button
5. Select "Cloud" -> "Providers", select a provider, and select the new button group and button
6. Fill in the fields in the service dialog, and select "Submit"

Actual results:
CloudForms displays an error:
undefined method `redirect_url' for #<#<Class:0x000000170b29a0>:0x0000000a5a69a0> [ems_cloud/dialog_form_button_pressed] 

The state machine is called correctly, however.

Expected results:
CloudForms calls the state machine, and redirects the user appropriately.

Comment 2 Greg McCullough 2016-11-28 14:15:50 UTC
Only reference I see to 'redirect_url' is in the controllers and persenters.  Sending to UI team to review first.

Comment 5 Martin Hradil 2017-05-11 10:33:20 UTC
This is present in 5.6.2.2, fixed in 5.6.3.3.


Relevant bit of the log:

```
[----] I, [2017-05-11T06:16:36.700073 #3174:10b1124]  INFO -- : Started POST "/ems_cloud/d
ialog_form_button_pressed/3?button=submit" for 127.0.0.1 at 2017-05-11 06:16:36 -0400
[----] I, [2017-05-11T06:16:36.701153 #3174:10b1124]  INFO -- : Processing by EmsCloudCont
roller#dialog_form_button_pressed as JS
[----] I, [2017-05-11T06:16:36.701235 #3174:10b1124]  INFO -- :   Parameters: {"button"=>"
submit", "id"=>"3"}
[----] F, [2017-05-11T06:16:37.471093 #3174:10b1124] FATAL -- : Error caught: [NoMethodErr
or] undefined method `redirect_url' for #<#<Class:0x0000000bbdff50>:0x0000000af51630>
/var/www/miq/vmdb/app/controllers/application_controller/dialog_runner.rb:69:in `block in 
dialog_form_button_pressed'
/opt/rh/cfme-gemset/bundler/gems/jquery-rjs-1288c097aa1c/lib/action_view/helpers/jquery_he
lper.rb:154:in `instance_exec'
/opt/rh/cfme-gemset/bundler/gems/jquery-rjs-1288c097aa1c/lib/action_view/helpers/jquery_he
lper.rb:154:in `block in initialize'
/opt/rh/cfme-gemset/gems/actionview-5.0.0.1/lib/action_view/helpers/capture_helper.rb:203:
in `with_output_buffer'
/opt/rh/cfme-gemset/bundler/gems/jquery-rjs-1288c097aa1c/lib/action_view/helpers/jquery_he
lper.rb:153:in `initialize'
/opt/rh/cfme-gemset/bundler/gems/jquery-rjs-1288c097aa1c/lib/jquery-rjs/renderers.rb:7:in 
`new'
/opt/rh/cfme-gemset/bundler/gems/jquery-rjs-1288c097aa1c/lib/jquery-rjs/renderers.rb:7:in 
`block in <module:Renderers>'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/renderers.rb:152:i
n `block in _render_to_body_with_renderer'
/opt/rh/rh-ruby22/root/usr/share/ruby/set.rb:283:in `each_key'
/opt/rh/rh-ruby22/root/usr/share/ruby/set.rb:283:in `each'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/renderers.rb:148:i
n `_render_to_body_with_renderer'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/renderers.rb:144:i
n `render_to_body'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/abstract_controller/rendering.rb:26:in `re
nder'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/rendering.rb:36:in
 `render'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb
:44:in `block (2 levels) in render'
/opt/rh/cfme-gemset/gems/activesupport-5.0.0.1/lib/active_support/core_ext/benchmark.rb:12
:in `block in ms'
/opt/rh/rh-ruby22/root/usr/share/ruby/benchmark.rb:303:in `realtime'
/opt/rh/cfme-gemset/gems/activesupport-5.0.0.1/lib/active_support/core_ext/benchmark.rb:12
:in `ms'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb
:44:in `block in render'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb
:87:in `cleanup_view_runtime'
/opt/rh/cfme-gemset/gems/activerecord-5.0.0.1/lib/active_record/railties/controller_runtim
e.rb:25:in `cleanup_view_runtime'
/opt/rh/cfme-gemset/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb
:43:in `render'
/var/www/miq/vmdb/app/controllers/application_controller/dialog_runner.rb:67:in `dialog_fo
rm_button_pressed'
...
```

This got fixed by https://github.com/ManageIQ/manageiq/pull/12137/commits/5c553a3291fbb1f5570b3a7618b2695c61ca8d26 (PR: https://github.com/ManageIQ/manageiq/pull/12137 )

Marking as a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1378507

*** This bug has been marked as a duplicate of bug 1378507 ***