summaryrefslogtreecommitdiff
path: root/lib/facter/root_home.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/facter/root_home.rb')
-rw-r--r--lib/facter/root_home.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/facter/root_home.rb b/lib/facter/root_home.rb
index 61fcf39..8249f7d 100644
--- a/lib/facter/root_home.rb
+++ b/lib/facter/root_home.rb
@@ -7,7 +7,9 @@ module Facter::Util::RootHome
def get_root_home
root_ent = Facter::Util::Resolution.exec("getent passwd root")
# The home directory is the sixth element in the passwd entry
- root_ent.split(":")[5]
+ # If the platform doesn't have getent, root_ent will be nil and we should
+ # return it straight away.
+ root_ent && root_ent.split(":")[5]
end
end
end