Feature #9766

hostname fact doesn't handle hostnames with dots (relative to domainname)

Added by Doug Balmer over 1 year ago. Updated over 1 year ago.

Status:AcceptedStart date:09/27/2011
Priority:LowDue date:
Assignee:Dexter Plameras% Done:

0%

Category:library
Target version:-
Keywords:uname, hostname, posix Affected Facter version:
Branch:

Description

Some of us for various reasons like to have “hostname"s that are "relative names” that could contain a period. “example.com” below is the domain name.

root@pdms01.lpr:/usr/lib/ruby/site_ruby/1.8/facter # rpm -qa| grep puppet
puppet-2.6.6-1.el5
root@pdms01.lpr:/usr/lib/ruby/site_ruby/1.8/facter # rpm -qa| grep facter
facter-1.5.8-1
root@pdms01.lpr:/usr/lib/ruby/site_ruby/1.8/facter # hostname
pdms01.lpr
root@pdms01.lpr:/usr/lib/ruby/site_ruby/1.8/facter # hostname -f
pdms01.lpr.example.com
root@pdms01.lpr:/usr/lib/ruby/site_ruby/1.8/facter # uname -n
pdms01.lpr
root@pdms01.lpr:/usr/lib/ruby/site_ruby/1.8/facter # sysctl kernel.hostname
kernel.hostname = pdms01.lpr
root@pdms01.lpr:/usr/lib/ruby/site_ruby/1.8/facter # facter hostname
pdms01

hostname.rb.patch Magnifier - Patch for getting hostname correctly (517 Bytes) Doug Balmer, 09/28/2011 12:04 am

History

#1 Updated by James Turnbull over 1 year ago

  • Affected Facter version changed from 1.6.1rc4 to 1.5.8

#2 Updated by James Turnbull over 1 year ago

  • Status changed from Unreviewed to Needs Decision

This is a really sweeping change. I am not even sure I concur with it. Thoughts Ken?

#3 Updated by Doug Balmer over 1 year ago

Although I ran factor with version 1.5.8, the attached patch is against the latest download 1.6.1rc4. Either way, both exhibit the same behaviour.

#4 Updated by Ken Barber over 1 year ago

  • Subject changed from hostname fact is incorrect to hostname fact doesn't handle hostnames with dots (relative to domainname)
  • Affected Facter version changed from 1.5.8 to 1.6.1rc4

Doug Balmer wrote:

Some of us for various reasons like to have “hostname"s that are "relative names” that could contain a period. “example.com” below is the domain name.

So the premise here is that ‘hostname’ is really the relative name once the domainname is removed from fqdn. In some ways I concur as I have used multi-part ‘hostnames’ before like this but I think its very subjective and needs debate.

On the negative another way to look at this is that really a hostname could be relative to varying parts of a domain. So lets say you have:

foo1.production.city.country.mydomain.com

Out of the following what would the hostname be?

foo1
foo1.production
foo1.production.city
foo1.production.city.country

(and in-turn what is the domainname?)

I think the important question Doug is really what you want to do with this information that you can’t do without breaking down the $fqdn using functions like split etc. Or with say regexp matching for node definitions or using the $fqdn fact. What is the real world use case that makes this important to you?

#5 Updated by Ken Barber over 1 year ago

  • Assignee deleted (Ken Barber)

After chatting to James I think I’m not wanting to make a decision on this one by myself. I would want a greater debate from the community I think as changing this known behaviour is dangerous for existing installations, and is to some extent the proposal has some subjective aspects.

I’m going to continue to watch this but remove myself as an assignee until something is agreed – but if you can state your case on the list Doug and reference this ticket that would be the best I think.

The user list is here:

http://groups.google.com/group/puppet-users

Thanks.

#6 Updated by Nigel Kersten over 1 year ago

  • Assignee set to Nigel Kersten

#7 Updated by Ken Barber over 1 year ago

  • Affected Facter version deleted (1.6.1rc4)

Current puppet-users discussion is here

#8 Updated by Ken Barber over 1 year ago

  • Category set to library
  • Affected Facter version set to 1.6.1

#9 Updated by Ken Barber over 1 year ago

  • Priority changed from Normal to Low
  • Keywords set to uname, hostname, posix
  • Affected Facter version changed from 1.6.1 to 1.6.2rc1

So Nigel,

Right now the discussion has continued in the thread inidicated above and I think some good points have been made. I can’t get traction on priority as it seems only a couple of people are wanting this now but I’m of the believe that the solution proposed is not a terrible one to work around this issue. In that we create a set of new facts:

uname_nodename: is uname -n only and isn't contrived
uname_release: is uname -r
uname_version: is uname -v
...etc...

This duplicates a lot of facts in behaviour - but sticks to the posix
compliance interpretation only.

Dexter Plameras (easybeats – an old colleague of mine) has volunteered to help write a prototype. I’ll get him to join redmine and we can probably assign it to him if he still wants to help.

What do you think? I’m going to mark this as ‘low’ because I didn’t get a lot of people screaming for it – but its still important to some people – while it does have a purism feel about it – the solution does align more with the posix definitions.

#10 Updated by Nigel Kersten over 1 year ago

  • Status changed from Needs Decision to Accepted
  • Assignee changed from Nigel Kersten to Adrien Thebo

+1 on all counts, apart from the actual naming….

does “uname_*” make sense for platforms like Windows?

#11 Updated by Nigel Kersten over 1 year ago

  • Assignee deleted (Adrien Thebo)

woops. accidental assign to Thebo.

#12 Updated by Michael Stahnke over 1 year ago

  • Tracker changed from Bug to Feature
  • Affected Facter version deleted (1.6.2rc1)

This was not an RC introduced bug. I’d classify as a feature request, asking for a new set of facts.

#13 Updated by Ken Barber over 1 year ago

  • Assignee set to Dexter Plameras
  • Target version set to 2.0.0

Assigning to Dexter Plameras as a volunteer contributor.

See CONTRIBUTING.md in the github repo for more information but if you need help Dexter, just ask the puppet-dev mailing list or myself.

#14 Updated by Ken Barber over 1 year ago

  • Target version changed from 2.0.0 to 186

#15 Updated by Daniel Pittman over 1 year ago

  • Target version deleted (186)

Also available in: Atom PDF