facter 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of facter might be problematic. Click here for more details.
- data/CHANGELOG +31 -0
- data/Rakefile +41 -36
- data/conf/redhat/facter.spec +11 -4
- data/conf/solaris/pkginfo +1 -1
- data/install.rb +286 -286
- data/lib/facter.rb +211 -211
- data/lib/facter/Cfkey.rb +24 -24
- data/lib/facter/application.rb +1 -0
- data/lib/facter/architecture.rb +21 -29
- data/lib/facter/domain.rb +34 -34
- data/lib/facter/facterversion.rb +1 -1
- data/lib/facter/fqdn.rb +8 -8
- data/lib/facter/hardwareisa.rb +2 -2
- data/lib/facter/hardwaremodel.rb +12 -12
- data/lib/facter/hostname.rb +14 -14
- data/lib/facter/id.rb +3 -3
- data/lib/facter/interfaces.rb +13 -13
- data/lib/facter/ipaddress.rb +101 -101
- data/lib/facter/iphostnumber.rb +12 -12
- data/lib/facter/kernel.rb +7 -7
- data/lib/facter/kernelmajversion.rb +3 -3
- data/lib/facter/kernelrelease.rb +12 -12
- data/lib/facter/kernelversion.rb +5 -5
- data/lib/facter/lsb.rb +14 -14
- data/lib/facter/lsbmajdistrelease.rb +8 -8
- data/lib/facter/macaddress.rb +44 -44
- data/lib/facter/macosx.rb +21 -21
- data/lib/facter/manufacturer.rb +28 -28
- data/lib/facter/memory.rb +143 -115
- data/lib/facter/netmask.rb +4 -4
- data/lib/facter/network.rb +4 -4
- data/lib/facter/operatingsystem.rb +73 -69
- data/lib/facter/operatingsystemrelease.rb +85 -79
- data/lib/facter/osfamily.rb +31 -0
- data/lib/facter/path.rb +3 -3
- data/lib/facter/physicalprocessorcount.rb +8 -0
- data/lib/facter/processor.rb +91 -72
- data/lib/facter/ps.rb +3 -3
- data/lib/facter/puppetversion.rb +7 -7
- data/lib/facter/rubysitedir.rb +5 -5
- data/lib/facter/rubyversion.rb +1 -1
- data/lib/facter/ssh.rb +16 -16
- data/lib/facter/timezone.rb +3 -3
- data/lib/facter/uniqueid.rb +2 -2
- data/lib/facter/util/collection.rb +96 -96
- data/lib/facter/util/confine.rb +30 -30
- data/lib/facter/util/fact.rb +95 -95
- data/lib/facter/util/ip.rb +173 -173
- data/lib/facter/util/loader.rb +88 -88
- data/lib/facter/util/macosx.rb +46 -46
- data/lib/facter/util/manufacturer.rb +78 -78
- data/lib/facter/util/memory.rb +63 -63
- data/lib/facter/util/netmask.rb +34 -34
- data/lib/facter/util/plist.rb +1 -1
- data/lib/facter/util/plist/generator.rb +177 -177
- data/lib/facter/util/plist/parser.rb +166 -166
- data/lib/facter/util/processor.rb +88 -0
- data/lib/facter/util/resolution.rb +154 -154
- data/lib/facter/util/uptime.rb +42 -42
- data/lib/facter/util/values.rb +9 -9
- data/lib/facter/util/virtual.rb +68 -58
- data/lib/facter/util/vlans.rb +17 -17
- data/lib/facter/virtual.rb +105 -110
- data/lib/facter/vlans.rb +6 -6
- data/spec/fixtures/cpuinfo/amd64dual +57 -0
- data/spec/fixtures/cpuinfo/amd64quad +79 -0
- data/spec/fixtures/cpuinfo/amd64solo +23 -0
- data/spec/fixtures/cpuinfo/amd64tri +86 -0
- data/spec/fixtures/cpuinfo/bbg3-armel +12 -0
- data/spec/fixtures/cpuinfo/beaglexm-armel +12 -0
- data/spec/fixtures/cpuinfo/panda-armel +17 -0
- data/spec/fixtures/cpuinfo/ppc64 +19 -0
- data/spec/fixtures/cpuinfo/sparc +10 -0
- data/spec/fixtures/processorcount/solaris-sparc-kstat-cpu-info +1216 -0
- data/spec/fixtures/processorcount/solaris-x86_64-kstat-cpu-info +225 -0
- data/spec/integration/facter_spec.rb +18 -18
- data/spec/spec_helper.rb +10 -1
- data/spec/unit/architecture_spec.rb +54 -0
- data/spec/unit/domain_spec.rb +23 -0
- data/spec/unit/memory_spec.rb +78 -1
- data/spec/unit/physicalprocessorcount_spec.rb +41 -35
- data/spec/unit/processor_spec.rb +183 -2
- data/spec/unit/util/processor_spec.rb +62 -0
- data/spec/unit/util/uptime_spec.rb +4 -4
- data/spec/unit/util/virtual_spec.rb +26 -5
- data/spec/unit/virtual_spec.rb +47 -2
- data/spec/watchr.rb +125 -0
- metadata +20 -4
data/lib/facter/netmask.rb
CHANGED
@@ -18,9 +18,9 @@
|
|
18
18
|
require 'facter/util/netmask'
|
19
19
|
|
20
20
|
Facter.add("netmask") do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
confine :kernel => [ :sunos, :linux, :freebsd, :openbsd, :netbsd, :darwin, :"gnu/kfreebsd", :dragonfly ]
|
22
|
+
setcode do
|
23
|
+
Facter::NetMask.get_netmask
|
24
|
+
end
|
25
25
|
end
|
26
26
|
|
data/lib/facter/network.rb
CHANGED
@@ -13,9 +13,9 @@
|
|
13
13
|
require 'facter/util/ip'
|
14
14
|
|
15
15
|
Facter::Util::IP.get_interfaces.each do |interface|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
16
|
+
Facter.add("network_" + Facter::Util::IP.alphafy(interface)) do
|
17
|
+
setcode do
|
18
|
+
Facter::Util::IP.get_network_value(interface)
|
20
19
|
end
|
20
|
+
end
|
21
21
|
end
|
@@ -14,83 +14,87 @@
|
|
14
14
|
require 'facter/lsb'
|
15
15
|
|
16
16
|
Facter.add(:operatingsystem) do
|
17
|
-
|
18
|
-
|
17
|
+
confine :kernel => :sunos
|
18
|
+
setcode do "Solaris" end
|
19
19
|
end
|
20
20
|
|
21
21
|
Facter.add(:operatingsystem) do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
22
|
+
confine :kernel => :linux
|
23
|
+
setcode do
|
24
|
+
if Facter.value(:lsbdistid) == "Ubuntu"
|
25
|
+
"Ubuntu"
|
26
|
+
elsif FileTest.exists?("/etc/debian_version")
|
27
|
+
"Debian"
|
28
|
+
elsif FileTest.exists?("/etc/gentoo-release")
|
29
|
+
"Gentoo"
|
30
|
+
elsif FileTest.exists?("/etc/fedora-release")
|
31
|
+
"Fedora"
|
32
|
+
elsif FileTest.exists?("/etc/mandriva-release")
|
33
|
+
"Mandriva"
|
34
|
+
elsif FileTest.exists?("/etc/mandrake-release")
|
35
|
+
"Mandrake"
|
36
|
+
elsif FileTest.exists?("/etc/meego-release")
|
37
|
+
"MeeGo"
|
38
|
+
elsif FileTest.exists?("/etc/arch-release")
|
39
|
+
"Archlinux"
|
40
|
+
elsif FileTest.exists?("/etc/oracle-release")
|
41
|
+
"OracleLinux"
|
42
|
+
elsif FileTest.exists?("/etc/enterprise-release")
|
43
|
+
if FileTest.exists?("/etc/ovs-release")
|
44
|
+
"OVS"
|
45
|
+
else
|
46
|
+
"OEL"
|
47
|
+
end
|
48
|
+
elsif FileTest.exists?("/etc/arch-release")
|
49
|
+
"Arch"
|
50
|
+
elsif FileTest.exists?("/etc/vmware-release")
|
51
|
+
"VMWareESX"
|
52
|
+
elsif FileTest.exists?("/etc/redhat-release")
|
53
|
+
txt = File.read("/etc/redhat-release")
|
54
|
+
if txt =~ /centos/i
|
55
|
+
"CentOS"
|
56
|
+
elsif txt =~ /CERN/
|
57
|
+
"SLC"
|
58
|
+
elsif txt =~ /scientific/i
|
59
|
+
"Scientific"
|
60
|
+
elsif txt =~ /^cloudlinux/i
|
61
|
+
"CloudLinux"
|
62
|
+
else
|
63
|
+
"RedHat"
|
64
|
+
end
|
65
|
+
elsif FileTest.exists?("/etc/SuSE-release")
|
66
|
+
txt = File.read("/etc/SuSE-release")
|
67
|
+
if txt =~ /^SUSE LINUX Enterprise Server/i
|
68
|
+
"SLES"
|
69
|
+
elsif txt =~ /^SUSE LINUX Enterprise Desktop/i
|
70
|
+
"SLED"
|
71
|
+
elsif txt =~ /^openSUSE/i
|
72
|
+
"OpenSuSE"
|
73
|
+
else
|
74
|
+
"SuSE"
|
75
|
+
end
|
76
|
+
elsif FileTest.exists?("/etc/bluewhite64-version")
|
77
|
+
"Bluewhite64"
|
78
|
+
elsif FileTest.exists?("/etc/slamd64-version")
|
79
|
+
"Slamd64"
|
80
|
+
elsif FileTest.exists?("/etc/slackware-version")
|
81
|
+
"Slackware"
|
82
|
+
elsif FileTest.exists?("/etc/alpine-release")
|
83
|
+
"Alpine"
|
84
|
+
elsif Facter.value(:lsbdistdescription) =~ /Amazon Linux/
|
85
|
+
"Amazon"
|
83
86
|
end
|
87
|
+
end
|
84
88
|
end
|
85
89
|
|
86
90
|
Facter.add(:operatingsystem) do
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
confine :kernel => "VMkernel"
|
92
|
+
setcode do
|
93
|
+
"ESXi"
|
94
|
+
end
|
91
95
|
end
|
92
96
|
|
93
97
|
Facter.add(:operatingsystem) do
|
94
|
-
|
95
|
-
|
98
|
+
# Default to just returning the kernel as the operating system
|
99
|
+
setcode do Facter[:kernel].value end
|
96
100
|
end
|
@@ -9,6 +9,7 @@
|
|
9
9
|
# On Suse, derivatives, parses '/etc/SuSE-release' for a selection of version
|
10
10
|
# information.
|
11
11
|
# On Slackware, parses '/etc/slackware-version'.
|
12
|
+
# On Amazon Linux, returns the 'lsbdistrelease' value.
|
12
13
|
#
|
13
14
|
# On all remaining systems, returns the 'kernelrelease' value.
|
14
15
|
#
|
@@ -16,112 +17,112 @@
|
|
16
17
|
#
|
17
18
|
|
18
19
|
Facter.add(:operatingsystemrelease) do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
20
|
+
confine :operatingsystem => %w{CentOS Fedora oel ovs OracleLinux RedHat MeeGo Scientific SLC CloudLinux}
|
21
|
+
setcode do
|
22
|
+
case Facter.value(:operatingsystem)
|
23
|
+
when "CentOS", "RedHat", "Scientific", "SLC", "CloudLinux"
|
24
|
+
releasefile = "/etc/redhat-release"
|
25
|
+
when "Fedora"
|
26
|
+
releasefile = "/etc/fedora-release"
|
27
|
+
when "MeeGo"
|
28
|
+
releasefile = "/etc/meego-release"
|
29
|
+
when "OracleLinux"
|
30
|
+
releasefile = "/etc/oracle-release"
|
31
|
+
when "OEL", "oel"
|
32
|
+
releasefile = "/etc/enterprise-release"
|
33
|
+
when "OVS", "ovs"
|
34
|
+
releasefile = "/etc/ovs-release"
|
35
|
+
end
|
36
|
+
File::open(releasefile, "r") do |f|
|
37
|
+
line = f.readline.chomp
|
38
|
+
if line =~ /\(Rawhide\)$/
|
39
|
+
"Rawhide"
|
40
|
+
elsif line =~ /release (\d[\d.]*)/
|
41
|
+
$1
|
42
|
+
end
|
43
43
|
end
|
44
|
+
end
|
44
45
|
end
|
45
46
|
|
46
47
|
Facter.add(:operatingsystemrelease) do
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
confine :operatingsystem => %w{Debian}
|
49
|
+
setcode do
|
50
|
+
release = Facter::Util::Resolution.exec('cat /etc/debian_version')
|
51
|
+
end
|
51
52
|
end
|
52
53
|
|
53
54
|
Facter.add(:operatingsystemrelease) do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
55
|
+
confine :operatingsystem => %w{Ubuntu}
|
56
|
+
setcode do
|
57
|
+
release = Facter::Util::Resolution.exec('cat /etc/issue')
|
58
|
+
if release =~ /Ubuntu (\d+.\d+)/
|
59
|
+
$1
|
60
60
|
end
|
61
|
+
end
|
61
62
|
end
|
62
63
|
|
63
64
|
Facter.add(:operatingsystemrelease) do
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
65
|
+
confine :operatingsystem => %w{SLES SLED OpenSuSE}
|
66
|
+
setcode do
|
67
|
+
releasefile = Facter::Util::Resolution.exec('cat /etc/SuSE-release')
|
68
|
+
if releasefile =~ /^VERSION\s*=\s*(\d+)/
|
69
|
+
releasemajor = $1
|
70
|
+
if releasefile =~ /^PATCHLEVEL\s*=\s*(\d+)/
|
71
|
+
releaseminor = $1
|
72
|
+
elsif releasefile =~ /^VERSION\s=.*.(\d+)/
|
73
|
+
releaseminor = $1
|
74
|
+
else
|
75
|
+
releaseminor = "0"
|
76
|
+
end
|
77
|
+
releasemajor + "." + releaseminor
|
78
|
+
else
|
79
|
+
"unknown"
|
80
80
|
end
|
81
|
+
end
|
81
82
|
end
|
82
83
|
|
83
84
|
Facter.add(:operatingsystemrelease) do
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
85
|
+
confine :operatingsystem => %w{Slackware}
|
86
|
+
setcode do
|
87
|
+
release = Facter::Util::Resolution.exec('cat /etc/slackware-version')
|
88
|
+
if release =~ /Slackware ([0-9.]+)/
|
89
|
+
$1
|
90
90
|
end
|
91
|
+
end
|
91
92
|
end
|
92
93
|
|
93
94
|
Facter.add(:operatingsystemrelease) do
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end
|
95
|
+
confine :operatingsystem => %w{Bluewhite64}
|
96
|
+
setcode do
|
97
|
+
releasefile = Facter::Util::Resolution.exec('cat /etc/bluewhite64-version')
|
98
|
+
if releasefile =~ /^\s*\w+\s+(\d+)\.(\d+)/
|
99
|
+
$1 + "." + $2
|
100
|
+
else
|
101
|
+
"unknown"
|
102
102
|
end
|
103
|
+
end
|
103
104
|
end
|
104
105
|
|
105
106
|
Facter.add(:operatingsystemrelease) do
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
107
|
+
confine :operatingsystem => %w{VMwareESX}
|
108
|
+
setcode do
|
109
|
+
release = Facter::Util::Resolution.exec('vmware -v')
|
110
|
+
if release =~ /VMware ESX .*?(\d.*)/
|
111
|
+
$1
|
112
112
|
end
|
113
|
+
end
|
113
114
|
end
|
114
115
|
|
115
116
|
Facter.add(:operatingsystemrelease) do
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
end
|
117
|
+
confine :operatingsystem => %w{Slamd64}
|
118
|
+
setcode do
|
119
|
+
releasefile = Facter::Util::Resolution.exec('cat /etc/slamd64-version')
|
120
|
+
if releasefile =~ /^\s*\w+\s+(\d+)\.(\d+)/
|
121
|
+
$1 + "." + $2
|
122
|
+
else
|
123
|
+
"unknown"
|
124
124
|
end
|
125
|
+
end
|
125
126
|
end
|
126
127
|
|
127
128
|
Facter.add(:operatingsystemrelease) do
|
@@ -132,5 +133,10 @@ Facter.add(:operatingsystemrelease) do
|
|
132
133
|
end
|
133
134
|
|
134
135
|
Facter.add(:operatingsystemrelease) do
|
135
|
-
|
136
|
+
confine :operatingsystem => %W{Amazon}
|
137
|
+
setcode do Facter[:lsbdistrelease].value end
|
138
|
+
end
|
139
|
+
|
140
|
+
Facter.add(:operatingsystemrelease) do
|
141
|
+
setcode do Facter[:kernelrelease].value end
|
136
142
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Fact: osfamily
|
2
|
+
#
|
3
|
+
# Purpose: Returns the operating system
|
4
|
+
#
|
5
|
+
# Resolution:
|
6
|
+
# Maps operating systems to operating system families, such as linux
|
7
|
+
# distribution derivatives. Adds mappings from specific operating systems
|
8
|
+
# to kernels in the case that it is relevant.
|
9
|
+
#
|
10
|
+
# Caveats:
|
11
|
+
# This fact is completely reliant on the operatingsystem fact, and no
|
12
|
+
# heuristics are used
|
13
|
+
#
|
14
|
+
|
15
|
+
Facter.add(:osfamily) do
|
16
|
+
|
17
|
+
setcode do
|
18
|
+
case Facter.value(:operatingsystem)
|
19
|
+
when "RedHat", "Fedora", "CentOS", "Scientific", "SLC", "CloudLinux", "OracleLinux", "OVS", "OEL"
|
20
|
+
"RedHat"
|
21
|
+
when "Ubuntu", "Debian"
|
22
|
+
"Debian"
|
23
|
+
when "SLES", "SLED", "OpenSuSE", "SuSE"
|
24
|
+
"Suse"
|
25
|
+
when "Solaris"
|
26
|
+
"Solaris"
|
27
|
+
else
|
28
|
+
Facter.value("kernel")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/facter/path.rb
CHANGED
@@ -62,3 +62,11 @@ Facter.add('physicalprocessorcount') do
|
|
62
62
|
Facter::Util::WMI.execquery("select Name from Win32_Processor").Count
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
Facter.add('physicalprocessorcount') do
|
67
|
+
confine :kernel => :sunos
|
68
|
+
|
69
|
+
setcode do
|
70
|
+
Facter::Util::Resolution.exec("/usr/sbin/psrinfo -p")
|
71
|
+
end
|
72
|
+
end
|