Plugins with welcome pages need updating

As the PR for #23191 got merged, any plugins using welcome pages need to add route definitions for these in their plugin routes. If these are not already tested, now would also be a good time to add tests for that. :wink:

Hey, thanks. Is there an example plugin PR so I can blindly repeat the same?

For e.g. discovery it should be something like this:

diff --git a/config/routes.rb b/config/routes.rb
index 772340a..f5119ef 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,6 +6,8 @@ Rails.application.routes.draw do
   post 'os_selected_discovered_hosts'           => 'hosts#os_selected'
   post 'medium_selected_discovered_hosts'       => 'hosts#medium_selected'
 
+  get 'discovered_hosts/help', :action => :welcome, :controller => 'discovered_hosts'
+
   constraints(:id => /[^\/]+/) do
     resources :discovered_hosts, :except => [:new, :create] do
       member do

However, in my setup the discovered_hosts’ help page seems to be broken (unrelated to the route change), so I’m unsure if this is 100% correct.

I have never understood how this “help” pages work. In discovery plugin I have a welcome.html.erb view that renders “No discovered hosts found in this context” page when there are no records and this has been working fine for years.

This suggested patch adds ability to use /discovered_hosts/help URL which was previously not working, but I don’t believe there is any link in the discovery plugin to this URL. So I am not sure how useful the route is.

Anyway Fixes #27335 - getting rid of Rails 6 incomp by lzap ¡ Pull Request #481 ¡ theforeman/foreman_discovery ¡ GitHub

Thanks!