Bug #15250
closedNo Route Matches error when viewing salt states or environments on 1.12 nightly
Description
I encountered this error while working on a prototype for a future deployment, this isn't a high priority issue for me, but it looks like a fairly general problem that would need to be fixed in the salt plugin before it is ready for 1.12 .
Host is Ubuntu 16.04, foreman nightly, foreman-salt v 5.0.1.
Steps performed until bug occurred:- Normal Foreman-installer setup, smart proxy setup, provision setup.
- Followed docs in foreman-salt manual for 5.0 setup after enabling the nightly repository for plugins.
- Set up salt master with some basic environments, added a single simple haproxy class.
- Go to salt states page in foreman, click to import from proxy.
- Select class, click submit.
Both the environments page and the states page now return similar errors (differing only in the 'search' param):
Oops, we're sorry but something went wrong No route matches {:action=>"index", :controller=>"foreman_salt/hosts", :search=>"salt_state = haproxy"}
Full trace is attached.
Debug at:
http://debugs.theforeman.org/foreman-debug-mGvAX.tar.xz
If you need any more information, or want me to apply/test any patches, I'll try and keep and eye on this issue.
Files
Updated by Anonymous over 8 years ago
- Project changed from Salt to Foreman
- Translation missing: en.field_release set to 136
per IRC: <Dominic> mmoll: it might be a bug in our hash_for_*path monkey patch, since controller should be "hosts" and not prefixed with the engine name foreman_salt/.
Updated by Dominic Cleal over 8 years ago
- Status changed from New to Assigned
- Assignee set to Dominic Cleal
Updated by Dominic Cleal over 8 years ago
hash_for is no longer returning the :use_route
key in the hash on 1.12, which causes some caching ("recall") in actionpack/lib/action_dispatch/routing/route_set.rb to try and prepend foreman_salt/ to the controller name, assuming that "hosts" is relative to the current foreman_salt/environments controller.
1.11 hash_for returns:
=> {:action=>"index", :controller=>"hosts", :use_route=>"hosts", :only_path=>true, :search=>"salt_environment = ..."}
develop:
=> {:controller=>"hosts", :action=>"index", :search=>"salt_environment = ..."}
Edit: not "caching" as I said above, but actually it's the current controller name/prefix that's being prepended to the :controller given in the hash. It's treated as a relative controller name unless use_route is also given.
Updated by The Foreman Bot over 8 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3564 added
Updated by Dominic Cleal over 8 years ago
Thanks for taking the time to test nightlies/1.12 and report this issue, I expect the fix will be in an early 1.12 RC. The one-line patch linked in the pull request can also easily be applied to /usr/share/foreman/config/initializers/routing_hash_for.rb.
Updated by Alex Thompson over 8 years ago
Thanks for the quick work! Applying the patch on my end does indeed fix the problem.
Updated by Dominic Cleal over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 0cdd6598dfafe5d841047a3171b08e7730453340.