diff options
author | William Van Hevelingen <blkperl@cat.pdx.edu> | 2014-01-16 22:22:38 -0800 |
---|---|---|
committer | William Van Hevelingen <blkperl@cat.pdx.edu> | 2014-01-22 22:54:34 -0800 |
commit | fe676f0ac4e1d96e77ba7fe894408d8e7647eacc (patch) | |
tree | 49540bcda1fc5b7dc91c9920ba147200047679fa /lib | |
parent | e49d356fbf84798ebf7dbd5682de18c368b0ccec (diff) | |
download | puppet-stdlib-fe676f0ac4e1d96e77ba7fe894408d8e7647eacc.tar.gz puppet-stdlib-fe676f0ac4e1d96e77ba7fe894408d8e7647eacc.tar.bz2 |
(PUP-1459) Add support for root_home on OS X 10.9
getent does not exist on 10.9 so this commit uses
dscacheutil to query the homedir for the root user.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/root_home.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/facter/root_home.rb b/lib/facter/root_home.rb index 8249f7d..b4f87ff 100644 --- a/lib/facter/root_home.rb +++ b/lib/facter/root_home.rb @@ -17,3 +17,16 @@ end Facter.add(:root_home) do setcode { Facter::Util::RootHome.get_root_home } end + +Facter.add(:root_home) do + confine :kernel => :darwin + setcode do + str = Facter::Util::Resolution.exec("dscacheutil -q user -a name root") + hash = {} + str.split("\n").each do |pair| + key,value = pair.split(/:/) + hash[key] = value + end + hash['dir'].strip + end +end |