Skip to content

Commit

Permalink
Fixes BZ#2238952 - Selecting host group change form URL
Browse files Browse the repository at this point in the history
  • Loading branch information
stejskalleos committed Nov 13, 2023
1 parent 0696b6f commit b44b52e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/helpers/discovered_hosts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ def provision_button(host, authorization_options)
end

def host_path(host)
return super unless controller_name == 'discovered_hosts'
return discovered_host_path(host) if controller_name == 'discovered_hosts'

# This is a hack to fix the hostgroup selection on the discovered host edit page
# The hostgroup onChange action is replacing the form url from `/discovered_hosts/:id`
# to `/hosts/:id``, which is not correct (in this case) and it breaks the form submission
return super unless controller_name == 'hosts' && action_name == 'process_hostgroup'
return super unless Host::Discovered.find_by(id: host[:id])

discovered_host_path(host)
end

Expand Down

0 comments on commit b44b52e

Please sign in to comment.