Issue #2533 has been updated by Ben Hughes.

Status changed from Needs More Information to Closed

This is still an issue, in so much as I can reproduce it:

<pre>
[root@theo:~]# facter domain       
home.gateway
[root@theo:~]# facter operatingsystem
OpenBSD
[root@theo:~]# vi /etc/resolv.conf
[root@theo:~]# facter domain         
[root@theo:~]# vi /etc/resolv.conf
[root@theo:~]# facter domain      
i.am.not.a.real.domain
[root@theo:~]# head -1 /etc/resolv.conf
domain i.am.not.a.real.domain
[root@theo:~]# domainname 

[root@theo:~]# grep -v "#" /etc/hosts
127.0.0.1       localhost
::1             localhost
</pre>

The github repository with the fix in has gone away (and I think the author has 
moved to Chef by the looks of it too).

I am personally not sold on the idea of using something off the machine to 
report facts about the machine. And think it should return blank. But that's 
just me.

If you remove the domain from resolv.conf then you get the (in my eyes) other 
correct behaviour:

<pre>
[root@theo:~]# cat /etc/resolv.conf
nameserver 192.168.1.254
lookup file bind
[root@theo:~]# facter domain
[root@theo:~]# 
</pre>

>From the OpenBSD man page:

<pre>
     domain      Local domain name.  Most queries for names within this domain
                 can use short names relative to the local domain.  If no
                 domain entry is present, the domain is determined from the
                 local host name returned by gethostname(3); the domain part
                 is taken to be everything after the first ``.''.  Finally, if
                 the host name does not contain a domain part, the root domain
                 is assumed.
</pre>

So if you are setting domain in /etc/resolv.conf and facter picks it up I'd say 
it's again, doing the right thing!

Either way. I'm closing this as it's ancient and has two working modes that I 
feel do the right thing. Please shout at me and/or re-open if you do not 
concur! (:
----------------------------------------
Feature #2533: Facter's domain.rb resolves DNS domain wrong
https://projects.puppetlabs.com/issues/2533

Author: Alf Wachsmann
Status: Closed
Priority: High
Assignee: Paul Nasrat
Category: 
Target version: 1.6.0
Keywords: 
Branch: 


Hi,

my machine and DNS configuration is a little unusual for various reasons
and the latest version of facter's domain.rb guesses the DNS domain of the
nodes wrong.

[root@psdss101]# cat /etc/hosts
127.0.0.1               localhost.localdomain localhost
172.21.34.21            psdss101

So, no domain name here.

[root@psdss101]# dnsdomainname
[ returns an empty string ]
[root@psdss101]# domainname
(none)
[root@psdss101]# cat /etc/resolv.conf
search srv.pcdsn mgt.pcdsn dss.pcdsn cds.pcdsn
nameserver 172.21.32.20

[root@psdss101]# facter
domain => srv.pcdsn
facterversion => 1.5.5
fqdn => psdss101.srv.pcdsn
hostname => psdss101
[ shortened for readability ]

As you can see, facter simply uses the first domain it finds in
/etc/resolv.conf but that is not the correct domain for the host.
(If I were using NIS on my machines, it would report the NIS domain
as my DNS domain which would also be wrong.)

But DNS has it right:

[root@psdss101]# /usr/bin/host psdss101
psdss101.dss.pcdsn has address 172.21.34.21


Wouldn't it be better if facter would actually use DNS to find out the
DNS domain name instead of (badly) playing DNS itself?


This is on 64 bit RHEL5.2:
[root@psdss101]# cat /etc/redhat-release 
Red Hat Enterprise Linux Client release 5.2 (Tikanga)
[root@psdss101]# uname -a
Linux psdss101 2.6.18-128.1.14.el5_lustre.1.8.1 #1 SMP Mon Jul 20 07:30:22 MDT 
2009 x86_64 x86_64 x86_64 GNU/Linux


Thanks,
          Alf.




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to