FS#27732 - [initscripts] extend way to set hostname

Attached to Project: Arch Linux
Opened by Jakub Bittner (rexcze) - Tuesday, 27 December 2011, 09:02 GMT
Last edited by Tom Gundersen (tomegun) - Tuesday, 27 December 2011, 15:04 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Tom Gundersen (tomegun)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Hostname is set in /etc/rc.conf, but if /etc/rc.conf is managed on hundred nodes by puppet it is very difficult to set hostname. I suggest this:

If hostname in /etc/rc.conf is left blank system should take a look at /etc/hostname and set it according this file.
This task depends upon

Closed by  Tom Gundersen (tomegun)
Tuesday, 27 December 2011, 15:04 GMT
Reason for closing:  Implemented
Comment by Gaetan Bisson (vesath) - Tuesday, 27 December 2011, 10:07 GMT
I do not understand: what can be set in /etc/hostname can also be set in /etc/rc.conf (possibly via a trivial sed command) and vice versa; could you describe in more detail why you believe they are not equivalent?
Comment by Jakub Bittner (rexcze) - Tuesday, 27 December 2011, 10:15 GMT
Puppet manages rc.conf as file. If I change this file by sed and set different hostname on each computer, every puppet run puppet will replace this file, because it was changed by sed (replacing hostname). So Iam suggesting another approach for hostname setting. In this case Puppet(or another management system) will not manage /etc/hostname, because it is host specific and the hostname could be easily changed(set) without need to run sed or something
Comment by Gaetan Bisson (vesath) - Tuesday, 27 December 2011, 10:35 GMT
Thanks; I wasn't sure what you meant by "puppet" but I see now.

My personal opinion is that retaining a unique file for the most basic configuration items should be preferred to splitting this file into many subfiles, however optional they may be at first. And it would be quite sad if decisions on such matters were driven by technical limitations of tools such as puppet, which one can perfectly well overcome with a simple combination of standard Unix tools.
Comment by Jakub Bittner (rexcze) - Tuesday, 27 December 2011, 10:44 GMT
Ok, well. I dont want to change the arch rc.conf way. I like it, because it is very easy to maintain configuration. But I suggest extending this easy way to be "more" powerfull in some causes (in enterprise).

I can create script which change hostname after puppet runs, but are you sure it is the right way? I think its not.
Comment by Gaetan Bisson (vesath) - Tuesday, 27 December 2011, 11:10 GMT
The right way would be to improve puppet upstream. As to whether we should do what we suggest, I'll let the initscripts maintainer decide.
Comment by Tom Gundersen (tomegun) - Tuesday, 27 December 2011, 11:45 GMT
In principle I'm in favor of supporting /etc/hostname, but I got some objections last time I suggested it, and can't say I care enough to fight this particular battle.

This (http://0pointer.de/public/systemd-man/hostname.html) is what is done on at least Debian, Ubuntu, Fedora and Suse so supporting this also on Arch seems like a good idea to me. We would not install this file by default, but use it if the admin creates it (like we do with vconsloe.conf and locale.conf).

As to using sed for editing rc.conf, this will work in all sensible cases. However, there is nothing stopping users from being stupid and creating a function in rc.conf that computes the hostname in arbitrary ways.

The authors of Puppy (or similar software) can of course say that they only support "reasonable" rc.conf, but I would understand if the authors would not find this very satisfying.

Lastly, HOSTNAME is already special. This is the only variable defined in rc.conf that really should be set, the rest are optional. If we added support for /etc/hostname, we could boot with an empty rc.conf, or more likely, one that just contains DAEMONS (which is the only truly Arch specific thing we have, the rest of rc.conf is just us doing the same as everyone else in our own way).
Comment by Gaetan Bisson (vesath) - Tuesday, 27 December 2011, 12:07 GMT
I am convinced by the "everybody else is doing it, so why can't we?" argument. Standards are a good thing, even de facto ones.

I just don't think we should split HOSTNAME to its own file *only* because certain tools prefer that (because then, we might as well make DAEMONS a directory containing one file per rc.d script to be launched, etc.).
Comment by Tom Gundersen (tomegun) - Tuesday, 27 December 2011, 14:43 GMT
@vesath: I agree. The only reason I ever change or add anything is in order to be closer to "everyone else".

I'd be against changing the way we deal with DAEMONS in any meaningful way (as we are the only ones doing anything like that).

I'll push out a new patch to add /etc/hostname support and see if anyone tries to kill me :-)

Loading...