summaryrefslogtreecommitdiffstats
path: root/lib/facter/fqdn.rb
blob: 090ca6306068731d1bbf1d177d12e1f641421135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Fact: fqdn
#
# Purpose: Returns the fully qualified domain name of the host.
#
# Resolution: Simply joins the hostname fact with the domain name fact.
#
# Caveats: No attempt is made to check that the two facts are accurate or that
# the two facts go together. At no point is there any DNS resolution made
# either.
#

Facter.add(:fqdn) do
    setcode do
        host = Facter.value(:hostname)
        domain = Facter.value(:domain)
        if host and domain
            [host, domain].join(".")
        else
            nil
        end
    end
end