Project

General

Profile

Feature #165

Subdomain should be shown for hostname.

Added by Bash Shell over 9 years ago. Updated almost 8 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

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?

withoutsetting.png View withoutsetting.png 51.9 KB Bash Shell, 04/06/2010 06:25 AM
with_setting.png View with_setting.png 52.7 KB Bash Shell, 04/06/2010 06:25 AM
Withoutsetting With setting

Related issues

Related to Foreman - Bug #816: hosts list and FQDN of hostsDuplicate2011-04-01
Has duplicate Foreman - Bug #1315: Short hostname confusionDuplicate2011-11-11

History

#1 Updated by Ohad Levy over 9 years ago

would filtering based on a fact would be a good idea?

#2 Updated by Ohad Levy over 9 years ago

  • Status changed from New to Feedback

#3 Updated by Bash Shell over 9 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)

#4 Updated by Ohad Levy over 9 years ago

is this still requires after #183?

#5 Updated by Bash Shell over 9 years ago

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.

#6 Updated by Bash Shell over 9 years ago

This is how I use the SETTING:

SETTINGS[:domain_name].nil? ? name : name.chomp(SETTINGS[:domain_name])

#7 Updated by Bash Shell over 9 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?

#8 Updated by Bash Shell over 9 years ago

The above hack that I was using does not work in the latest develop branch.

#9 Updated by Kal McFate over 8 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? )

#10 Updated by Bash Shell over 8 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},

#11 Updated by Ohad Levy over 8 years ago

  • Status changed from Feedback to Duplicate

#12 Updated by Ohad Levy over 8 years ago

  • Status changed from Duplicate to New

#13 Updated by Ohad Levy over 8 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)

#14 Updated by Bash Shell over 8 years ago

Yes, showing a sortable domain column will work for us.

#15 Updated by Brian Gupta over 8 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.

#16 Updated by Ohad Levy almost 8 years ago

  • Status changed from Feedback to Duplicate
  • Target version set to 0.4.1

Also available in: Atom PDF