summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/facter.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/facter.rb b/lib/facter.rb
index c663c8c..1b497c8 100644
--- a/lib/facter.rb
+++ b/lib/facter.rb
@@ -687,6 +687,18 @@ class Facter
end
end
end
+ # Look for the DNS domain name command first.
+ Facter.add("Domain") do
+ setcode do
+ domain = Resolution.exec('dnsdomainname') or nil
+ # make sure it's a real domain
+ if domain and domain =~ /.+\..+/
+ domain
+ else
+ nil
+ end
+ end
+ end
Facter.add("Domain") do
setcode do
domain = Resolution.exec('domainname') or nil