Feature #165
closedSubdomain should be shown for hostname.
Description
By default, foreman shows the short domain name for hosts.
However, we have multiple sites, lets say site1.example.com and site2.example.com.
Sometimes we have servers with names mysql1.site1 and mysql1.site2
This is hard to distinguish in foreman as it shows "mysql1" for both. (We have to click it)
I changed the "shortname" function in ./app/models/host.rb like so:
#domain.nil? ? name : name.chomp("." + domain.name) domain.nil? ? name : name.chomp(".example.com")
Now the hosts show up as mysql1.site1 and mysql1.site2, which makes much better readability.
Perhaps there could be a configurable setting for this?
One could specify how much of a domain name to show/hide?
Files
Updated by Ohad Levy almost 15 years ago
would filtering based on a fact would be a good idea?
Updated by Bash Shell almost 15 years ago
Ohad Levy wrote:
would filtering based on a fact would be a good idea?
Perhaps there could be a setting in the settings file.
It could specify "how much" of the domain I want to truncate.
(Like the number of "dots" settings in the resolv.conf file)
Updated by Bash Shell over 14 years ago
- File withoutsetting.png withoutsetting.png added
- File with_setting.png with_setting.png added
It would still be nice to have this... the search bar really does not help as far as readability of the Host links.
This would also apply to all pages (Errors, Reports and not just Hosts).
It just makes Foreman look more readable(at least for us with our rather long domain name.)
I add a SETTING to settings.yaml and use that in the above line of code.
I've attached two screen shots to illustrate what I mean.
As you can see, the two servers have the same name and unless we show the sub domain, its harder to visually differentiate.
And if we add our full domain name, its just longer and not as readable.
Updated by Bash Shell over 14 years ago
This is how I use the SETTING:
SETTINGS[:domain_name].nil? ? name : name.chomp(SETTINGS[:domain_name])
Updated by Bash Shell over 14 years ago
Any love for this ticket. :)
I am still using the above hack.
Are you planning to change the Hosts page in other ways to add this feature?
Updated by Bash Shell over 14 years ago
The above hack that I was using does not work in the latest develop branch.
Updated by Kal McFate almost 14 years ago
Uhm, Ditto on wanting this. With multiple data centers we use a subdomain for each, now I just see multiple short host names and it detracts a lot from the usability. I'd prefer just cutting off the domain name. On a side note, I tried assigning all hosts to just domain.com instead of sub.domain.com, however puppet fact imports overwrite this. This was not the expected behavior as release notes for 0.1-6 mention:
"In previous version, when entering a FQDN as the hostname, Foreman would automatically create the domain name for the host, however, as its legitimate to have a full stop (".") as part of the hostname, foreman can no longer know what is the correct domain name, and therefore will not create it, if the domain already exists, Foreman would still associate the host to it."
I suppose I could fudge this on the facter end. Any suggestions ( a working hack? )
Updated by Bash Shell almost 14 years ago
The original hack still works.
It needs the following additional change in app/views/hosts/_form.html.erb:
diff -Naur usr/share/foreman/app/views/hosts/_form.html.erb /usr/share/foreman/app/views/hosts/_form.html.erb --- usr/share/foreman/app/views/hosts/_form.html.erb 2011-02-12 09:51:12.000000000 -0800 +++ /usr/share/foreman/app/views/hosts/_form.html.erb 2011-02-16 12:02:59.000000000 -0800 @@ -5,7 +5,7 @@ <table> <tr> <td>Name</td> - <td><%= f.text_field :name, :size => 16, :value => @host.shortname %></td> + <td><%= f.text_field :name, :size => 16, :value => @host.name %></td> <td>Host group</td> <td> <%= f.collection_select :hostgroup_id, accessible_hostgroups, :id, :name, {:include_blank => true},
Updated by Ohad Levy over 13 years ago
- Status changed from Feedback to Duplicate
Updated by Ohad Levy over 13 years ago
- Status changed from New to Feedback
would showing the domain column (and sortable) would make things any better?
ideally, I would think that we need to create sub navigation under hosts per domains (if the domain count is bigger than 1 for example)
Updated by Bash Shell over 13 years ago
Yes, showing a sortable domain column will work for us.
Updated by Brian Gupta over 13 years ago
How difficult would it be to make the view customizable? I'm thinking every shop has different requirements on data they would feel important for this hostlist. (We might even consider multiple views, with default views that are tied to RBAC) I know this could be done with improved searching, but I am thinking something a little lighter weight, and prominent.
Updated by Ohad Levy about 13 years ago
- Status changed from Feedback to Duplicate
- Target version set to 0.4.1