puppetlabs/facter — pull request #702 by wdoekes (2014-06-23 19:52:37+00:00)
Title: (FACT-598) Use `hostname -f` for `fqdn` if available.

(This is a retry of pull request #680. Changed branch. Added JIRA ticket reference.)

Some systems have a hostname other than the concatenation of `hostname`
and `dnsdomainname`. Or put differently, the `hostname -s` is not equal
to `hostname`:

$ hostname -f
systemX.locationY.domain.tld
$ hostname
domain-systemX

This keeps the local hostname short yet detailed enough.

In that case, the right FQDN would be obtained by concatenating the
(short!) `hostname -s` with `dnsdomanname`:

$ hostname -s
systemX
$ dnsdomainname
locationY.domain.tld

However, `facter fqdn` returns this:

$ facter fqdn
domain-systemX.locationY.domain.tld
^-- wrong, should be: systemX.locationY.domain.tld

This patch changes things so that on systems with `hostname -f`, that
value is used instead.