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

Also available in: Atom PDF