blob: 188efa4cda9c3fe26760efe981b382ddd1ced0ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
Facter.add(:hostname, :ldapname => "cn") do
setcode do
hostname = nil
name = Facter::Util::Resolution.exec('hostname') or nil
if name
if name =~ /^([\w-]+)\.(.+)$/
hostname = $1
# the Domain class uses this
$domain = $2
else
hostname = name
end
hostname
else
nil
end
end
end
Facter.add(:hostname) do
confine :kernel => :darwin, :kernelrelease => "R7"
setcode do
%x{/usr/sbin/scutil --get LocalHostName}
end
end
|