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

Fixes BZ#2238952 - Selecting host group change form URL #609

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/helpers/discovered_hosts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,15 @@ def provision_button(host, authorization_options)
end

def host_path(host)
return super unless controller_name == 'discovered_hosts'
discovered_host_path(host)
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 discovered_host_path(host) if controller_name == 'hosts' &&
action_name == 'process_hostgroup' &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I'm OK with specifying this particular method as it's the one that causes the bug, I wonder if we shouldn't include all the AJAX methods from the controller

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but I'm worried about the impact it can have across the plugins. This fix is right now important for downstream release, can we go with it as it is and later on think about the refactoring? Dont want to block QAs who are waiting for this fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good for me. Let's start with this, and deal with the fallout later.

Host::Discovered.find_by(id: host[:id])

super
end

def discovery_doc_version
Expand Down
Loading