Last change
on this file since 30903 was 30903, checked in by davidb, 8 years ago |
Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details
|
File size:
1.1 KB
|
Rev | Line | |
---|
[30903] | 1 | # A facter fact to determine the root home directory.
|
---|
| 2 | # This varies on PE supported platforms and may be
|
---|
| 3 | # reconfigured by the end user.
|
---|
| 4 |
|
---|
| 5 | module Facter::Util::RootHome
|
---|
| 6 | class << self
|
---|
| 7 | def get_root_home
|
---|
| 8 | root_ent = Facter::Util::Resolution.exec("getent passwd root")
|
---|
| 9 | # The home directory is the sixth element in the passwd entry
|
---|
| 10 | # If the platform doesn't have getent, root_ent will be nil and we should
|
---|
| 11 | # return it straight away.
|
---|
| 12 | root_ent && root_ent.split(":")[5]
|
---|
| 13 | end
|
---|
| 14 | end
|
---|
| 15 | end
|
---|
| 16 |
|
---|
| 17 | Facter.add(:root_home) do
|
---|
| 18 | setcode { Facter::Util::RootHome.get_root_home }
|
---|
| 19 | end
|
---|
| 20 |
|
---|
| 21 | Facter.add(:root_home) do
|
---|
| 22 | confine :kernel => :darwin
|
---|
| 23 | setcode do
|
---|
| 24 | str = Facter::Util::Resolution.exec("dscacheutil -q user -a name root")
|
---|
| 25 | hash = {}
|
---|
| 26 | str.split("\n").each do |pair|
|
---|
| 27 | key,value = pair.split(/:/)
|
---|
| 28 | hash[key] = value
|
---|
| 29 | end
|
---|
| 30 | hash['dir'].strip
|
---|
| 31 | end
|
---|
| 32 | end
|
---|
| 33 |
|
---|
| 34 | Facter.add(:root_home) do
|
---|
| 35 | confine :kernel => :aix
|
---|
| 36 | root_home = nil
|
---|
| 37 | setcode do
|
---|
| 38 | str = Facter::Util::Resolution.exec("lsuser -c -a home root")
|
---|
| 39 | str && str.split("\n").each do |line|
|
---|
| 40 | next if line =~ /^#/
|
---|
| 41 | root_home = line.split(/:/)[1]
|
---|
| 42 | end
|
---|
| 43 | root_home
|
---|
| 44 | end
|
---|
| 45 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.