From 6c2a003f2139a482f92f245ce1d49830be13c5f1 Mon Sep 17 00:00:00 2001 From: Jon Fautley Date: Thu, 27 Aug 2015 14:53:02 +0100 Subject: (MODULES-2478) Support root_home fact on AIX through "lsuser" command Squashed, and amended test for comment lines. --- lib/facter/root_home.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/facter/root_home.rb b/lib/facter/root_home.rb index b4f87ff..ee3ffa8 100644 --- a/lib/facter/root_home.rb +++ b/lib/facter/root_home.rb @@ -30,3 +30,16 @@ Facter.add(:root_home) do hash['dir'].strip end end + +Facter.add(:root_home) do + confine :kernel => :aix + root_home = nil + setcode do + str = Facter::Util::Resolution.exec("lsuser -C -a home root") + str && str.split("\n").each do |line| + next if line =~ /^#/ + root_home = line.split(/:/)[1] + end + root_home + end +end -- cgit v1.2.3