[Setup-tool-hackers] Hostname on RedHat



While trying to fix a particular bug with the network setup tool on Red
Hat 7.2, I came accross a much bigger issue. The setup tool needs an
interface change. I don't have the authority to do so, and I also don't
want to do the work if it won't be committed. So here is my reasoning,
tell me how stupid I am.

For the Red Hat 7.x series (possibly 6.x too, i don't know) the network
tool back end gets the 'hostname' from the HOSTNAME variable in
/etc/sysconfig/network. Simple enough, but... some people don't set a
HOSTNAME at all, they let it get set by dhcp. 

<for-instance>
When my linux box boots it will grab any of 6 IP's I lease from my
provider. I get them from a DHCP server (actually my router). My real,
true, reverse-dns'able hostname is something like
cpe-66-87-194-144.tx.sprintbbd.net. Thus I do not set a hostname
manually. I *could* and still let my hostname be overriden by hacking
/etc/resolv.conf (or one other file I forget at the moment).
</for-instance>

The problem right now is, network-admin is confusing and crashes. Here's
why: The Host name it displays on the first tab is the one it gets from
/etc/sysconfig/network's HOSTNAME. If I don't have HOSTNAME specified
(or if it is empty) in /etc/sysconfig/network then the 'Host name' field
on the tool is blank. But that isn't right because I have a hostname! 

If I try to type a hostname in there right now it crashes when I try to
apply the changes because of some null fields in the XML file related to
where it gets hostname. The rabbit hole goes deeper.

So, what's the solution? Well, in RedHat it is entirely possible to have
a different hostname than whats in /etc/sysconfig/network. I don't know
about other distro's. The question becomes: Which hostname do we use?
Which one do we over write?

The solution: 
1. Display the *current* system hostname (you can get this by running
'hostname') in a label above the 'Host name' field.
i.e. "Current hostname: cpe-66-87-194-144"

2. Provide an option for getting the hostname from dhcp/dns or setting
it manually.

"[x] Get Host Name from DHCP"

3. If it is unchecked then enable (un-gray) the 'Host Name' field.

4. The 'Host Name' field will always display what is saved in
/etc/sysconfig/network

To fix the crashing from null fields I'll just have to add a parameter
in the backend script to differentiate between 'hostname' and 'current
hostname'. 

LMK what you guys think

-ryan




_______________________________________________
setup-tool-hackers maillist  -  setup-tool-hackers@ximian.com
http://lists.ximian.com/mailman/listinfo/setup-tool-hackers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]