Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visiting /vm_or_template/explorer/:id yields an error #6696

Open
Fryguy opened this issue Feb 20, 2020 · 9 comments
Open

Visiting /vm_or_template/explorer/:id yields an error #6696

Fryguy opened this issue Feb 20, 2020 · 9 comments

Comments

@Fryguy
Copy link
Member

Fryguy commented Feb 20, 2020

While this is an uncommon route it is exposed via routes.rb and should seemingly redirect, but it gives this error...

[----] F, [2020-02-20T17:28:08.313450 #42457:3ff50a0512b8] FATAL -- : Error caught: [NoMethodError] undefined method `underscore' for nil:NilClass
/Users/jfrey/.gem/ruby/2.5.7/bundler/gems/manageiq-ui-classic-c5c45590cf53/app/controllers/vm_or_template_controller.rb:30:in `prefix_by_nodetype'
/Users/jfrey/.gem/ruby/2.5.7/bundler/gems/manageiq-ui-classic-c5c45590cf53/app/controllers/vm_or_template_controller.rb:38:in `set_elements_and_redirect_unauthorized_user'
/Users/jfrey/.gem/ruby/2.5.7/bundler/gems/manageiq-ui-classic-c5c45590cf53/app/controllers/mixins/vm_show_mixin.rb:41:in `explorer'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/abstract_controller/base.rb:186:in `process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/activesupport-5.1.7/lib/active_support/callbacks.rb:131:in `run_callbacks'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/abstract_controller/callbacks.rb:19:in `process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal/rescue.rb:20:in `process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in `block in instrument'
/Users/jfrey/.gem/ruby/2.5.7/gems/activesupport-5.1.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/jfrey/.gem/ruby/2.5.7/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in `instrument'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/activerecord-5.1.7/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/abstract_controller/base.rb:124:in `process'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionview-5.1.7/lib/action_view/rendering.rb:30:in `process'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal.rb:189:in `dispatch'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_controller/metal.rb:253:in `dispatch'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/routing/route_set.rb:31:in `serve'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/journey/router.rb:50:in `block in serve'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/journey/router.rb:33:in `each'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/journey/router.rb:33:in `serve'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/routing/route_set.rb:844:in `call'
/Users/jfrey/dev/manageiq/lib/request_started_on_middleware.rb:12:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/etag.rb:27:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/conditional_get.rb:27:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/head.rb:14:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/session/abstract/id.rb:269:in `context'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/session/abstract/id.rb:263:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/cookies.rb:613:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
/Users/jfrey/.gem/ruby/2.5.7/gems/activesupport-5.1.7/lib/active_support/callbacks.rb:97:in `run_callbacks'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/railties-5.1.7/lib/rails/rack/logger.rb:36:in `call_app'
/Users/jfrey/.gem/ruby/2.5.7/gems/railties-5.1.7/lib/rails/rack/logger.rb:26:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/request_id.rb:25:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/method_override.rb:24:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/runtime.rb:24:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/activesupport-5.1.7/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/actionpack-5.1.7/lib/action_dispatch/middleware/static.rb:125:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/rack-2.1.2/lib/rack/sendfile.rb:113:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/secure_headers-3.9.0/lib/secure_headers/middleware.rb:12:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/railties-5.1.7/lib/rails/engine.rb:522:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/puma-4.3.1/lib/puma/configuration.rb:228:in `call'
/Users/jfrey/.gem/ruby/2.5.7/gems/puma-4.3.1/lib/puma/server.rb:681:in `handle_request'
/Users/jfrey/.gem/ruby/2.5.7/gems/puma-4.3.1/lib/puma/server.rb:472:in `process_client'
/Users/jfrey/.gem/ruby/2.5.7/gems/puma-4.3.1/lib/puma/server.rb:328:in `block in run'
/Users/jfrey/.gem/ruby/2.5.7/gems/puma-4.3.1/lib/puma/thread_pool.rb:134:in `block in spawn_thread'

cc @himdel

@himdel
Copy link
Contributor

himdel commented Feb 21, 2020

Right, so, the route actually does work, only it expects tree ids, not object ids.

So, first access to /vm_infra/explorer/v-1:

good

But access to /vm_infra/explorer/1:

bad

@himdel
Copy link
Contributor

himdel commented Feb 21, 2020

But, the second is not the "Record not found" screen, or anything nice, so this still needs fixing :).

Also, in the case of this explorer:

  • all the trees come from the same database table
  • it does not matter whether I use v-1 or t-1 (1 being a vm id) or t-13 or v-13 (13 being a template id), it goes to the right record, and always picks the first accordion

So, we should probably just accept a raw id as well.

@miq-bot
Copy link
Member

miq-bot commented Jun 11, 2020

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation.

@miq-bot miq-bot added the stale label Jun 11, 2020
@Fryguy Fryguy removed the stale label Jun 16, 2020
@Fryguy
Copy link
Member Author

Fryguy commented Jun 16, 2020

cc @skateman Not sure if your dead routes detection was aware of this one or not. (it's not actually dead, so probably not...more just wanted it on your radar)

@skateman
Copy link
Member

skateman commented Jun 16, 2020

Yeah, working on it #7131

EDIT: this is not actually related to the dead routes, this can happen on any route. Basically anything you send after the / is treated as params[:id], this is a rails feature.

@chessbyte
Copy link
Member

@Fryguy @kavyanekkalapu is this still an issue or resolved in #7131 ?

@kavyanekkalapu
Copy link
Member

kavyanekkalapu commented Oct 6, 2021

I am not able to understand the issue. Can we access specific record details of explorer table record using id?

Only route working for me is -> http://localhost:3000/vm_or_template/explorer#/

@Fryguy
Copy link
Member Author

Fryguy commented Oct 7, 2021

This is still an issue in the sense that the route table lets you hit a URL like http://localhost:3000/vm_or_template/explorer/1, but you get an error page with a stack trace issue that blows up as opposed to something like the 404 page, which is more expected. Similarly you can hit http://localhost:3000/vm_or_template/explorer/abc and instead of 404 it blows up. http://localhost:3000/vm_or_template/explorer/v-1 is an example of a URL that works correctly, because we expect a tree-id.

There are multiple ways to fix, the easiest being to just catch unexpected id values and redirect to 404. Alternatively, we could support id-based URLs as well which would allow for deep linking.

@miq-bot
Copy link
Member

miq-bot commented Feb 27, 2023

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@miq-bot miq-bot added the stale label Feb 27, 2023
@Fryguy Fryguy removed the stale label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants