facter 2.3.0-x64-mingw32 → 2.4.0-x64-mingw32
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/lib/facter/application.rb +1 -1
- data/lib/facter/core/logging.rb +31 -3
- data/lib/facter/dhcp_servers.rb +5 -0
- data/lib/facter/interfaces.rb +10 -3
- data/lib/facter/ipaddress.rb +10 -12
- data/lib/facter/macaddress.rb +2 -1
- data/lib/facter/operatingsystemmajrelease.rb +9 -6
- data/lib/facter/os.rb +38 -9
- data/lib/facter/partitions.rb +3 -0
- data/lib/facter/processors.rb +15 -9
- data/lib/facter/system32.rb +1 -1
- data/lib/facter/system_uptime.rb +2 -0
- data/lib/facter/util/config.rb +5 -1
- data/lib/facter/util/dhcp_servers.rb +17 -2
- data/lib/facter/util/directory_loader.rb +8 -3
- data/lib/facter/util/ip.rb +60 -5
- data/lib/facter/util/ip/windows.rb +2 -2
- data/lib/facter/util/partitions.rb +4 -0
- data/lib/facter/util/partitions/linux.rb +6 -0
- data/lib/facter/util/partitions/openbsd.rb +5 -0
- data/lib/facter/util/resolution.rb +1 -1
- data/lib/facter/util/uptime.rb +5 -4
- data/lib/facter/util/virtual.rb +13 -2
- data/lib/facter/version.rb +1 -1
- data/lib/facter/virtual.rb +1 -1
- data/spec/unit/core/logging_spec.rb +119 -0
- data/spec/unit/dhcp_servers_spec.rb +38 -0
- data/spec/unit/operatingsystem/sunos_spec.rb +0 -1
- data/spec/unit/partitions_spec.rb +4 -2
- data/spec/unit/system32_spec.rb +2 -2
- data/spec/unit/util/config_spec.rb +1 -1
- data/spec/unit/util/directory_loader_spec.rb +15 -1
- data/spec/unit/util/uptime_spec.rb +11 -5
- data/spec/unit/virtual_spec.rb +9 -0
- metadata +659 -651
- checksums.yaml +0 -7
data/lib/facter/application.rb
CHANGED
data/lib/facter/core/logging.rb
CHANGED
@@ -21,6 +21,22 @@ module Facter::Core::Logging
|
|
21
21
|
# @api private
|
22
22
|
@@debug_messages = {}
|
23
23
|
|
24
|
+
# @api private
|
25
|
+
@@message_callback = nil
|
26
|
+
|
27
|
+
# Used to register a callback that is called when a message is logged.
|
28
|
+
# If a block is given, Facter will not log messages.
|
29
|
+
# If a block is not given, Facter will resume logging messages.
|
30
|
+
# @param block [Proc] the callback to call when a message is logged.
|
31
|
+
# The first argument to the callback will be a symbol representing a level. The supported
|
32
|
+
# levels are: :trace, :debug, :info, :warn, :error, and :fatal.
|
33
|
+
# The second argument to the callback will be a string containing the message
|
34
|
+
# that was logged.
|
35
|
+
# @api public
|
36
|
+
def on_message(&block)
|
37
|
+
@@message_callback = block
|
38
|
+
end
|
39
|
+
|
24
40
|
# Prints a debug message if debugging is turned on
|
25
41
|
#
|
26
42
|
# @param msg [String] the debug message
|
@@ -30,6 +46,8 @@ module Facter::Core::Logging
|
|
30
46
|
if msg.nil? or msg.empty?
|
31
47
|
invoker = caller[0].slice(/.*:\d+/)
|
32
48
|
self.warn "#{self.class}#debug invoked with invalid message #{msg.inspect}:#{msg.class} at #{invoker}"
|
49
|
+
elsif @@message_callback
|
50
|
+
@@message_callback.call(:debug, msg)
|
33
51
|
else
|
34
52
|
puts GREEN + msg + RESET
|
35
53
|
end
|
@@ -59,7 +77,10 @@ module Facter::Core::Logging
|
|
59
77
|
def warn(msg)
|
60
78
|
if msg.nil? or msg.empty?
|
61
79
|
invoker = caller[0].slice(/.*:\d+/)
|
62
|
-
|
80
|
+
msg = "#{self.class}#debug invoked with invalid message #{msg.inspect}:#{msg.class} at #{invoker}"
|
81
|
+
end
|
82
|
+
if @@message_callback
|
83
|
+
@@message_callback.call(:warn, msg)
|
63
84
|
else
|
64
85
|
Kernel.warn msg
|
65
86
|
end
|
@@ -111,7 +132,13 @@ module Facter::Core::Logging
|
|
111
132
|
#
|
112
133
|
# @api private
|
113
134
|
def show_time(string)
|
114
|
-
|
135
|
+
return unless string && self.timing?
|
136
|
+
|
137
|
+
if @@message_callback
|
138
|
+
@@message_callback.call(:info, string)
|
139
|
+
else
|
140
|
+
$stderr.puts "#{GREEN}#{string}#{RESET}"
|
141
|
+
end
|
115
142
|
end
|
116
143
|
|
117
144
|
# Enable or disable logging of debug messages
|
@@ -158,12 +185,13 @@ module Facter::Core::Logging
|
|
158
185
|
@@trace
|
159
186
|
end
|
160
187
|
|
161
|
-
# Clears the seen state of warning messages. See {warnonce}.
|
188
|
+
# Clears the seen state of debug and warning messages. See {debugonce} and {warnonce}.
|
162
189
|
#
|
163
190
|
# @return [void]
|
164
191
|
#
|
165
192
|
# @api private
|
166
193
|
def clear_messages
|
194
|
+
@@debug_messages.clear
|
167
195
|
@@warn_messages.clear
|
168
196
|
end
|
169
197
|
end
|
data/lib/facter/dhcp_servers.rb
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
# If the interface that is the default gateway is DHCP assigned, there
|
6
6
|
# will also be a `"system"` entry in the hash.
|
7
7
|
#
|
8
|
+
# This fact is structured. Values are returned as a group of key-value pairs.
|
9
|
+
#
|
8
10
|
# Resolution:
|
9
11
|
# Parses the output of `nmcli` to find the DHCP server for the interface if available.
|
10
12
|
#
|
@@ -21,6 +23,9 @@ Facter.add(:dhcp_servers) do
|
|
21
23
|
confine do
|
22
24
|
Facter::Core::Execution.which('nmcli')
|
23
25
|
end
|
26
|
+
confine do
|
27
|
+
Facter::Util::DHCPServers.network_manager_state != 'unknown'
|
28
|
+
end
|
24
29
|
|
25
30
|
setcode do
|
26
31
|
gwdev = Facter::Util::DHCPServers.gateway_device
|
data/lib/facter/interfaces.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
# Fact: interfaces
|
2
2
|
#
|
3
3
|
# Purpose:
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
4
|
+
# Returns a comma-separated list of the system's network interfaces.
|
5
|
+
#
|
6
|
+
# In addition to the main `interfaces` fact, this code will generate the
|
7
|
+
# following facts for each interface:
|
8
|
+
#
|
9
|
+
# * `ipaddress_<INTERFACE>`
|
10
|
+
# * `ipaddress6_<INTERFACE>`
|
11
|
+
# * `macaddress_<INTERFACE>`
|
12
|
+
# * `netmask_<INTERFACE>`
|
13
|
+
# * `mtu_<INTERFACE>`
|
7
14
|
#
|
8
15
|
# Resolution:
|
9
16
|
#
|
data/lib/facter/ipaddress.rb
CHANGED
@@ -49,7 +49,7 @@ Facter.add(:ipaddress) do
|
|
49
49
|
ip = nil
|
50
50
|
output = Facter::Util::IP.exec_ifconfig
|
51
51
|
|
52
|
-
output.split(/^\S/).each
|
52
|
+
output.split(/^\S/).each do |str|
|
53
53
|
if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
|
54
54
|
tmp = $1
|
55
55
|
unless tmp =~ /^127\./
|
@@ -57,7 +57,7 @@ Facter.add(:ipaddress) do
|
|
57
57
|
break
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
end
|
61
61
|
|
62
62
|
ip
|
63
63
|
end
|
@@ -69,7 +69,7 @@ Facter.add(:ipaddress) do
|
|
69
69
|
ip = nil
|
70
70
|
output = Facter::Util::IP.exec_ifconfig(["-a"])
|
71
71
|
|
72
|
-
output.split(/^\S/).each
|
72
|
+
output.split(/^\S/).each do |str|
|
73
73
|
if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
|
74
74
|
tmp = $1
|
75
75
|
unless tmp =~ /^127\./ or tmp == "0.0.0.0"
|
@@ -77,7 +77,7 @@ Facter.add(:ipaddress) do
|
|
77
77
|
break
|
78
78
|
end
|
79
79
|
end
|
80
|
-
|
80
|
+
end
|
81
81
|
|
82
82
|
ip
|
83
83
|
end
|
@@ -87,17 +87,15 @@ Facter.add(:ipaddress) do
|
|
87
87
|
confine :kernel => %w{AIX}
|
88
88
|
setcode do
|
89
89
|
ip = nil
|
90
|
-
output = Facter::Util::IP.exec_ifconfig(["-a"])
|
91
90
|
|
92
|
-
|
91
|
+
default_interface = Facter::Util::IP.exec_netstat(["-rn | grep default | awk '{ print $6 }'"])
|
92
|
+
output = Facter::Util::IP.exec_ifconfig([default_interface])
|
93
|
+
|
94
|
+
output.split(/^\S/).each do |str|
|
93
95
|
if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
|
94
|
-
|
95
|
-
unless tmp =~ /^127\./
|
96
|
-
ip = tmp
|
97
|
-
break
|
98
|
-
end
|
96
|
+
ip = $1
|
99
97
|
end
|
100
|
-
|
98
|
+
end
|
101
99
|
|
102
100
|
ip
|
103
101
|
end
|
data/lib/facter/macaddress.rb
CHANGED
@@ -72,7 +72,8 @@ Facter.add(:macaddress) do
|
|
72
72
|
setcode do
|
73
73
|
ether = []
|
74
74
|
ip = nil
|
75
|
-
|
75
|
+
default_interface = Facter::Util::IP.exec_netstat(["-rn | grep default | awk '{ print $6 }'"])
|
76
|
+
output = Facter::Util::IP.exec_ifconfig([default_interface])
|
76
77
|
output.each_line do |str|
|
77
78
|
if str =~ /([a-z]+\d+): flags=/
|
78
79
|
devname = $1
|
@@ -3,11 +3,14 @@
|
|
3
3
|
# Purpose: Returns the major release of the operating system.
|
4
4
|
#
|
5
5
|
# Resolution:
|
6
|
-
# Uses the
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# character
|
6
|
+
# Uses the release['major'] entry of the os structured fact, which itself
|
7
|
+
# attempts to use its own release['full'] entry to determine the major release value.
|
8
|
+
# In RedHat osfamily derivatives and Debian, splits down the release string for a decimal point
|
9
|
+
# and uses the first non-decimal character.
|
10
|
+
# In Solaris, uses the first non-decimal character of the release string.
|
11
|
+
# In Ubuntu, uses the characters before and after the first decimal point, as in '14.04'.
|
12
|
+
# In Windows, uses the full release string in the case of server releases, such as '2012 R2',
|
13
|
+
# and uses the first non-decimal character in the cases of releases such as '8.1'.
|
11
14
|
#
|
12
15
|
# This should be the same as lsbmajdistrelease, but on minimal systems there
|
13
16
|
# are too many dependencies to use LSB
|
@@ -16,7 +19,7 @@
|
|
16
19
|
# "Alpine" "Amazon" "Archlinux" "Ascendos" "Bluewhite64" "CentOS" "CloudLinux"
|
17
20
|
# "Debian" "Fedora" "Gentoo" "Mandrake" "Mandriva" "MeeGo" "OEL" "OpenSuSE"
|
18
21
|
# "OracleLinux" "OVS" "PSBM" "RedHat" "Scientific" "Slackware" "Slamd64" "SLC"
|
19
|
-
# "SLED" "SLES" "SuSE" "Ubuntu" "VMWareESX"
|
22
|
+
# "SLED" "SLES" "Solaris" "SuSE" "Ubuntu" "VMWareESX"
|
20
23
|
#
|
21
24
|
|
22
25
|
Facter.add(:operatingsystemmajrelease) do
|
data/lib/facter/os.rb
CHANGED
@@ -1,29 +1,58 @@
|
|
1
1
|
# Fact: os
|
2
2
|
#
|
3
3
|
# Purpose:
|
4
|
-
# Return various facts related to the machine's operating system
|
4
|
+
# Return various facts related to the machine's operating system, including:
|
5
|
+
# Name: The name of the operating system.
|
6
|
+
# Family: A mapping of the operating system to an operating system family.
|
7
|
+
# Release: The release version of the operating system. Includes entries for the
|
8
|
+
# major and minor release versions, as well as the full release string.
|
9
|
+
# Lsb: Linux Standard Base information for the system.
|
10
|
+
#
|
11
|
+
# This fact is structured. These values are returned as a group of key-value pairs.
|
5
12
|
#
|
6
13
|
# Resolution:
|
7
|
-
# For
|
8
|
-
#
|
14
|
+
# For the name entry, if the kernel is a Linux kernel, check for the existence of a
|
15
|
+
# selection of files in `/etc` to find the specific flavor.
|
9
16
|
# On SunOS based kernels, attempt to determine the flavor, otherwise return Solaris.
|
10
17
|
# On systems other than Linux, use the kernel value.
|
11
18
|
#
|
12
|
-
# For
|
19
|
+
# For the family entry, map operating systems to operating system families, such
|
20
|
+
# as linux distribution derivatives. Adds mappings from specific operating systems
|
21
|
+
# to kernels in the case that it is relevant.
|
22
|
+
#
|
23
|
+
# For the release entry, on RedHat derivatives, returns `/etc/<variant>-release` file.
|
13
24
|
# On Debian, returns `/etc/debian_version`.
|
14
25
|
# On Ubuntu, parses `/etc/lsb-release` for the release version
|
15
|
-
# On Suse and derivatives, parses `/etc/SuSE-release` for a selection of version
|
26
|
+
# On Suse and derivatives, parses `/etc/SuSE-release` for a selection of version
|
27
|
+
# information.
|
16
28
|
# On Slackware, parses `/etc/slackware-version`.
|
17
29
|
# On Amazon Linux, returns the lsbdistrelease fact's value.
|
18
30
|
# On Mageia, parses `/etc/mageia-release` for the release version.
|
19
31
|
# On all remaining systems, returns the kernelrelease fact's value.
|
20
32
|
#
|
21
|
-
# For the
|
33
|
+
# For the major version, uses the value of the full release string to determine the major
|
34
|
+
# release version.
|
35
|
+
# In RedHat osfamily derivatives and Debian, splits down the release string for a decimal point
|
36
|
+
# and uses the first non-decimal character.
|
37
|
+
# In Solaris, uses the first non-decimal character of the release string.
|
38
|
+
# In Ubuntu, uses the characters before and after the first decimal point, as in '14.04'.
|
39
|
+
# In Windows, uses the full release string in the case of server releases, such as '2012 R2',
|
40
|
+
# and uses the first non-decimal character in the cases of releases such as '8.1'.
|
41
|
+
#
|
42
|
+
# For the minor version, attempts to split the full release version string and return
|
43
|
+
# the value of the character after the first decimal.
|
44
|
+
#
|
45
|
+
# For the lsb entries, uses the `lsb_release` system command.
|
22
46
|
#
|
23
47
|
# Caveats:
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
48
|
+
# The family entry is completely reliant on the name key, and no heuristics are used.
|
49
|
+
#
|
50
|
+
# The major and minor release sub-facts of the release entry are not currenty
|
51
|
+
# supported on all platforms.
|
52
|
+
#
|
53
|
+
# The lsb entries only work on Linux (and the kfreebsd derivative) systems. Requires
|
54
|
+
# the `lsb_release` program, which may not be installed by default. It is only as
|
55
|
+
# accurate as the output of `lsb_release`.
|
27
56
|
#
|
28
57
|
|
29
58
|
require 'facter/operatingsystem/implementation'
|
data/lib/facter/partitions.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
# Purpose:
|
4
4
|
# Return the details of the disk partitions.
|
5
5
|
#
|
6
|
+
# This fact is structured. Values are returned as a group of key-value pairs.
|
7
|
+
#
|
6
8
|
# Resolution:
|
7
9
|
# Parse the contents of `/sys/block/<device>/size` to receive the size (multiplying by 512 to correct for blocks-to-bytes).
|
8
10
|
#
|
@@ -27,6 +29,7 @@ Facter.add(:partitions) do
|
|
27
29
|
details['uuid'] = Facter::Util::Partitions.uuid(part)
|
28
30
|
details['size'] = Facter::Util::Partitions.size(part)
|
29
31
|
details['mount'] = Facter::Util::Partitions.mount(part)
|
32
|
+
details['label'] = Facter::Util::Partitions.label(part)
|
30
33
|
details['filesystem'] = Facter::Util::Partitions.filesystem(part)
|
31
34
|
details.reject! {|k,v| v.nil? || v.to_s.empty? }
|
32
35
|
partitions[part] = details
|
data/lib/facter/processors.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
# Fact: processors
|
2
2
|
#
|
3
3
|
# Purpose:
|
4
|
-
#
|
5
|
-
#
|
4
|
+
# Provide additional facts about the machine's CPUs, including:
|
5
|
+
# Models: A list of processors present on the system.
|
6
|
+
# Count: The number of hardware threads.
|
7
|
+
# Physicalcount: The number of physical processors.
|
8
|
+
# Speed: The speed of the processors on the system.
|
9
|
+
#
|
10
|
+
# This fact is structured. These values are returned as a group of key-value pairs.
|
6
11
|
#
|
7
12
|
# Resolution:
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# the physical CPU count and speed.
|
13
|
+
# Linux and kFreeBSD parse `/proc/cpuinfo` for each processor.
|
14
|
+
# AIX parses the output of `lsdev` for its processor section.
|
15
|
+
# Solaris parses the output of `kstat` for each processor.
|
16
|
+
# OpenBSD uses the sysctl variables `hw.model` and `hw.ncpu` for the CPU model
|
17
|
+
# and the CPU count respectively.
|
18
|
+
# Darwin utilizes the system profiler to collect the physical CPU count and speed.
|
15
19
|
#
|
20
|
+
# Caveats:
|
21
|
+
# The 'speed' sub-fact is not currently supported on all platforms.
|
16
22
|
|
17
23
|
require 'facter/processors/os'
|
18
24
|
|
data/lib/facter/system32.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
Facter.add(:system32) do
|
13
13
|
confine :kernel => :windows
|
14
14
|
setcode do
|
15
|
-
if File.
|
15
|
+
if File.exist?("#{ENV['SYSTEMROOT']}\\sysnative")
|
16
16
|
"#{ENV['SYSTEMROOT']}\\sysnative"
|
17
17
|
else
|
18
18
|
"#{ENV['SYSTEMROOT']}\\system32"
|
data/lib/facter/system_uptime.rb
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
# seconds, hours, days and a general, human
|
6
6
|
# readable uptime.
|
7
7
|
#
|
8
|
+
# This fact is structured. These values are returned as a group of key-value pairs.
|
9
|
+
#
|
8
10
|
# Resolution:
|
9
11
|
# Does basic math on the get_uptime_seconds utility
|
10
12
|
# to calculate seconds, hours and days.
|
data/lib/facter/util/config.rb
CHANGED
@@ -41,7 +41,11 @@ module Facter::Util::Config
|
|
41
41
|
if Facter::Util::Root.root?
|
42
42
|
windows_dir = windows_data_dir
|
43
43
|
if windows_dir.nil? then
|
44
|
-
|
44
|
+
# Note: Beginning with Facter 3, /opt/puppetlabs/agent/facts.d will be the only
|
45
|
+
# default external fact directory.
|
46
|
+
@external_facts_dirs = ["/opt/puppetlabs/agent/facts.d",
|
47
|
+
"/etc/facter/facts.d",
|
48
|
+
"/etc/puppetlabs/facter/facts.d"]
|
45
49
|
else
|
46
50
|
@external_facts_dirs = [File.join(windows_dir, 'PuppetLabs', 'facter', 'facts.d')]
|
47
51
|
end
|
@@ -25,9 +25,8 @@ module Facter::Util::DHCPServers
|
|
25
25
|
|
26
26
|
def self.device_dhcp_server(device)
|
27
27
|
if Facter::Core::Execution.which('nmcli')
|
28
|
-
version = self.nmcli_version
|
29
28
|
# If the version is >= 0.9.9, use show instead of list
|
30
|
-
if
|
29
|
+
if is_newer_nmcli?
|
31
30
|
Facter::Core::Execution.exec("nmcli -f all d show #{device}").scan(/dhcp_server_identifier.*?(\d+\.\d+\.\d+\.\d+)$/).flatten.first
|
32
31
|
else
|
33
32
|
Facter::Core::Execution.exec("nmcli -f all d list iface #{device}").scan(/dhcp_server_identifier.*?(\d+\.\d+\.\d+\.\d+)$/).flatten.first
|
@@ -35,9 +34,25 @@ module Facter::Util::DHCPServers
|
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
37
|
+
def self.network_manager_state
|
38
|
+
# If the version is >= 0.9.9, use g instead of nm
|
39
|
+
if is_newer_nmcli?
|
40
|
+
output = Facter::Core::Execution.exec('nmcli -t -f STATE g 2>/dev/null')
|
41
|
+
else
|
42
|
+
output = Facter::Core::Execution.exec('nmcli -t -f STATE nm 2>/dev/null')
|
43
|
+
end
|
44
|
+
return nil unless output
|
45
|
+
output.strip
|
46
|
+
end
|
47
|
+
|
38
48
|
def self.nmcli_version
|
39
49
|
if version = Facter::Core::Execution.exec("nmcli --version")
|
40
50
|
version.scan(/version\s(\d+)\.?(\d+)?\.?(\d+)?\.?(\d+)?/).flatten.map(&:to_i)
|
41
51
|
end
|
42
52
|
end
|
53
|
+
|
54
|
+
def self.is_newer_nmcli?
|
55
|
+
version = nmcli_version
|
56
|
+
version && (version[0] > 0 || version[1] > 9 || (version[1] == 9 && version[2] >= 9))
|
57
|
+
end
|
43
58
|
end
|
@@ -1,7 +1,10 @@
|
|
1
1
|
# A Facter plugin that loads external facts.
|
2
2
|
#
|
3
3
|
# Default Unix Directories:
|
4
|
-
# /etc/facter/facts.d
|
4
|
+
# /opt/puppetlabs/agent/facts.d, /etc/facter/facts.d, /etc/puppetlabs/facter/facts.d
|
5
|
+
#
|
6
|
+
# Beginning with Facter 3, only /opt/puppetlabs/agent/facts.d will be a default external fact
|
7
|
+
# directory in Unix.
|
5
8
|
#
|
6
9
|
# Default Windows Direcotires:
|
7
10
|
# C:\ProgramData\Puppetlabs\facter\facts.d (2008)
|
@@ -30,8 +33,9 @@ class Facter::Util::DirectoryLoader
|
|
30
33
|
# Directory for fact loading
|
31
34
|
attr_reader :directory
|
32
35
|
|
33
|
-
def initialize(dir)
|
36
|
+
def initialize(dir, weight = nil)
|
34
37
|
@directory = dir
|
38
|
+
@weight = weight || EXTERNAL_FACT_WEIGHT
|
35
39
|
end
|
36
40
|
|
37
41
|
def self.loader_for(dir)
|
@@ -52,6 +56,7 @@ class Facter::Util::DirectoryLoader
|
|
52
56
|
# Load facts from files in fact directory using the relevant parser classes to
|
53
57
|
# parse them.
|
54
58
|
def load(collection)
|
59
|
+
weight = @weight
|
55
60
|
entries.each do |file|
|
56
61
|
parser = Facter::Util::Parser.parser_for(file)
|
57
62
|
if parser == nil
|
@@ -64,7 +69,7 @@ class Facter::Util::DirectoryLoader
|
|
64
69
|
elsif data == {} or data == nil
|
65
70
|
Facter.warn "Fact file #{file} was parsed but returned an empty data set"
|
66
71
|
else
|
67
|
-
data.each { |p,v| collection.add(p, :value => v) { has_weight(
|
72
|
+
data.each { |p,v| collection.add(p, :value => v) { has_weight(weight) } }
|
68
73
|
end
|
69
74
|
end
|
70
75
|
end
|