Project

General

Profile

Actions

Bug #15391

closed

Hostgroup host links not quoted

Added by Mac Reid over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Host groups
Target version:
Difficulty:
trivial
Triaged:
Fixed in Releases:
Found in Releases:

Description

When clicking on a link for hosts in a hostgroup, the link does not quote the hostgroup name. When there is a space in the hostgroup name, the linked search does not show any hosts.

Steps to reproduce:

Create hostgroup with a space in the name.
Create host and add it to the newly created hostgroup.
On the hostgroups webpage, click on the hosts link for the newly created hostgroup.

The fix I applied on my Foreman instance:

diff --git a/app/views/hostgroups/index.html.erb b/app/views/hostgroups/index.html.erb
index d427bb9..ad6adf9 100644
--- a/app/views/hostgroups/index.html.erb
+++ b/app/views/hostgroups/index.html.erb
@@ -18,10 +18,10 @@
           <%= label_with_link(hostgroup, 150, authorizer) %>
         </td>
         <td>
-          <%= link_to hostgroup.hosts_count, hosts_path(:search => "hostgroup_fullname = #{hostgroup.title}") %>
+          <%= link_to hostgroup.hosts_count, hosts_path(:search => %Q[hostgroup_fullname = "#{hostgroup.title}"]) %>
         </td>
         <td>
-          <%= link_to hostgroup.children_hosts_count, hosts_path(:search => "parent_hostgroup = #{hostgroup.title}") %>
+          <%= link_to hostgroup.children_hosts_count, hosts_path(:search => %Q[parent_hostgroup = "#{hostgroup.title}"]) %>
         </td>
         <td>
           <%= action_buttons(

Actions #1

Updated by Dominic Cleal over 8 years ago

  • Difficulty set to trivial

If you'd like to get your patch included, please do open up a pull request with the instructions at https://theforeman.org/contribute.html - just commit it with a message similar to "fixes #15391 - quote host group search links".

Actions #2

Updated by The Foreman Bot over 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3589 added
Actions #3

Updated by Dominic Cleal over 8 years ago

  • Assignee set to Mac Reid
  • Translation missing: en.field_release set to 161
Actions #4

Updated by Mac Reid over 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF