summaryrefslogtreecommitdiffstats
path: root/lib/facter/domain.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/facter/domain.rb')
-rw-r--r--lib/facter/domain.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/facter/domain.rb b/lib/facter/domain.rb
index 5dfead0..b1bba4d 100644
--- a/lib/facter/domain.rb
+++ b/lib/facter/domain.rb
@@ -4,14 +4,14 @@ Facter.add(:domain) do
# steps is important
Facter.value(:hostname)
- # try to fetch the domain from hostname if long hostname is used.
- if defined? $fqdn and $fqdn =~ /^([\w-]+)\.(.+)$/
- next $2
- end
+ next $domain if defined? $domain and ! $domain.nil?
domain = Facter::Util::Resolution.exec('dnsdomainname')
next domain if domain =~ /.+\..+/
+ domain = Facter::Util::Resolution.exec('domainname')
+ next domain if domain =~ /.+\..+/
+
if FileTest.exists?("/etc/resolv.conf")
domain = nil
search = nil