Parent hostgroup name is truncated when its sub-group is a sub-string of the parent hostgroup name
The name of a hostgroup is truncated in case the sub-hostgroup is a substring of its parent name: when "mi" group is created under "Rami" group - it looks like: "Ra/mi" instead of "Rami/mi"
Fixes #1789 - Parent hostgroup name is truncated when its sub-group is a sub-string of the parent hostgroup name
#1 Updated by Sam Kottler over 6 years ago
- Status changed from New to Feedback
I just spent a little while digging into this. This problem occurs in
app/helpers/hosts_and_hostgroups_helper.rbon line 5. The gsub method gets called on group.to_s, which is a complete string of the child hostgroup and all of its parents if there are any. Therefore, the name of the current group (group.name) without parents replaces all the instances of itself in group.to_s. The gsub should only get called on the substring after the last backslash (i.e. on "test", not "test/test").
I've spent enough time on this for today without a quick fix, so I'm going to move on, but I will revisit this later.