summaryrefslogtreecommitdiffstats
path: root/lib/facter/id.rb
blob: c2ab3b7d992a6131157ff64fc81bb1de4d615280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Facter.add(:id) do
    confine :operatingsystem => %w{Linux Fedora RedHat CentOS SuSE SLES Debian Ubuntu Gentoo AIX OEL OVS GNU/kFreeBSD}
    setcode "whoami"
end

Facter.add(:id) do
    confine :operatingsystem => %w{Solaris}
    setcode do
        if %x{id} =~ /^uid=\d+\((\S+)\)/
            $1
        else
            nil
        end
    end
end