facter 4.3.1 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/docs/generate_cli.rb +1 -1
- data/lib/facter/custom_facts/core/execution/base.rb +5 -4
- data/lib/facter/custom_facts/core/execution/posix.rb +1 -1
- data/lib/facter/custom_facts/core/execution/windows.rb +2 -2
- data/lib/facter/custom_facts/core/execution.rb +1 -1
- data/lib/facter/custom_facts/core/file_loader.rb +23 -24
- data/lib/facter/custom_facts/core/legacy_facter.rb +1 -1
- data/lib/facter/custom_facts/util/normalization.rb +8 -23
- data/lib/facter/custom_facts/util/windows_root.rb +1 -1
- data/lib/facter/facts/debian/architecture.rb +1 -1
- data/lib/facter/facts/linux/hypervisors/kvm.rb +2 -2
- data/lib/facter/facts/linux/os/architecture.rb +1 -1
- data/lib/facter/facts/linux/partitions.rb +4 -0
- data/lib/facter/facts/linux/processors/isa.rb +1 -10
- data/lib/facter/facts/ol/lsbdistdescription.rb +16 -0
- data/lib/facter/facts/ol/lsbdistid.rb +16 -0
- data/lib/facter/facts/ol/os/distro/description.rb +19 -0
- data/lib/facter/facts/ol/os/distro/id.rb +19 -0
- data/lib/facter/facts/windows/hypervisors/kvm.rb +2 -2
- data/lib/facter/framework/cli/cli_launcher.rb +3 -3
- data/lib/facter/framework/config/config_reader.rb +4 -0
- data/lib/facter/framework/config/fact_groups.rb +2 -2
- data/lib/facter/framework/core/fact_loaders/fact_loader.rb +14 -2
- data/lib/facter/framework/core/file_loader.rb +896 -38
- data/lib/facter/framework/core/options/config_file_options.rb +4 -0
- data/lib/facter/framework/core/options/options_validator.rb +9 -2
- data/lib/facter/framework/detector/os_hierarchy.rb +1 -1
- data/lib/facter/framework/formatters/legacy_fact_formatter.rb +1 -1
- data/lib/facter/framework/formatters/yaml_fact_formatter.rb +2 -2
- data/lib/facter/framework/parsers/query_parser.rb +2 -1
- data/lib/facter/patches/sysfilesystem/sys/statvfs.rb +4 -4
- data/lib/facter/resolvers/aix/architecture.rb +1 -1
- data/lib/facter/resolvers/aix/filesystem.rb +1 -1
- data/lib/facter/resolvers/aix/hardware.rb +1 -1
- data/lib/facter/resolvers/aix/memory.rb +1 -1
- data/lib/facter/resolvers/aix/mountpoints.rb +2 -2
- data/lib/facter/resolvers/aix/networking.rb +5 -3
- data/lib/facter/resolvers/aix/partitions.rb +2 -2
- data/lib/facter/resolvers/bsd/processors.rb +1 -1
- data/lib/facter/resolvers/freebsd/processors.rb +2 -2
- data/lib/facter/resolvers/freebsd/swap_memory.rb +1 -1
- data/lib/facter/resolvers/gce.rb +9 -0
- data/lib/facter/resolvers/linux/hostname.rb +2 -2
- data/lib/facter/resolvers/load_averages.rb +1 -1
- data/lib/facter/resolvers/lspci.rb +1 -1
- data/lib/facter/resolvers/macosx/swap_memory.rb +1 -1
- data/lib/facter/resolvers/networking.rb +1 -1
- data/lib/facter/resolvers/open_vz.rb +1 -1
- data/lib/facter/resolvers/os_release.rb +3 -3
- data/lib/facter/resolvers/selinux.rb +3 -3
- data/lib/facter/resolvers/solaris/ffi/functions.rb +5 -3
- data/lib/facter/resolvers/solaris/filesystems.rb +1 -1
- data/lib/facter/resolvers/solaris/mountpoints.rb +1 -1
- data/lib/facter/resolvers/virt_what.rb +6 -6
- data/lib/facter/resolvers/windows/ffi/hardware_ffi.rb +2 -2
- data/lib/facter/resolvers/windows/ffi/identity_ffi.rb +1 -1
- data/lib/facter/resolvers/windows/ffi/kernel_ffi.rb +2 -2
- data/lib/facter/resolvers/windows/ffi/memory_ffi.rb +2 -2
- data/lib/facter/resolvers/windows/ffi/networking_ffi.rb +3 -3
- data/lib/facter/resolvers/windows/ffi/system32_ffi.rb +1 -1
- data/lib/facter/resolvers/windows/ffi/winnls_ffi.rb +1 -1
- data/lib/facter/resolvers/windows/hardware_architecture.rb +1 -1
- data/lib/facter/resolvers/windows/identity.rb +1 -1
- data/lib/facter/resolvers/windows/kernel.rb +1 -1
- data/lib/facter/resolvers/windows/memory.rb +1 -1
- data/lib/facter/resolvers/windows/networking.rb +1 -1
- data/lib/facter/resolvers/windows/system32.rb +1 -1
- data/lib/facter/resolvers/windows/timezone.rb +1 -1
- data/lib/facter/resolvers/windows/virtualization.rb +2 -2
- data/lib/facter/resolvers/xen.rb +1 -1
- data/lib/facter/util/api_debugger.rb +1 -1
- data/lib/facter/util/facts/windows_release_finder.rb +2 -2
- data/lib/facter/util/linux/dhcp.rb +1 -1
- data/lib/facter/util/resolvers/ffi/hostname.rb +1 -1
- data/lib/facter/util/utils.rb +1 -1
- data/lib/facter/version.rb +1 -1
- data/lib/facter.rb +15 -6
- metadata +11 -8
- data/lib/facter/facts/windows/augeas/version.rb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74662429c9115d4eb8feca42d49031fa3be3ff42c200a8c6ee58c664f8afa9da
|
|
4
|
+
data.tar.gz: e1c21ea94af446c6700c27db8c24f150671f7ee8410b8e070436e709ff85fc87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a1a2529c0fe5df5da517bbcc8b76b2a53c5c138af5d83ebf8dc25b051d28861816ed4b8ab6c1e167ec4c6bcef50df7d68a34abd22f04442f44eaebd499f3bef
|
|
7
|
+
data.tar.gz: 6c31e966940c2d1a525c5fb1f416b5af15e2b8c57516c92eab6e74be361d198bd6494e26b85316758e7e42ff1eecc6fc3480c3f718b8de2e7d452bcde39911f0
|
data/lib/docs/generate_cli.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Facter
|
|
|
8
8
|
class Base
|
|
9
9
|
STDERR_MESSAGE = 'Command %s completed with the following stderr message: %s'
|
|
10
10
|
VALID_OPTIONS = %i[on_fail expand logger timeout].freeze
|
|
11
|
-
|
|
11
|
+
DEFAULT_EXECUTION_TIMEOUT = 300
|
|
12
12
|
def initialize
|
|
13
13
|
@log = Log.new(self)
|
|
14
14
|
end
|
|
@@ -65,7 +65,7 @@ module Facter
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def execute_command(command, on_fail = nil, logger = nil, timeout = nil)
|
|
68
|
-
timeout ||=
|
|
68
|
+
timeout ||= DEFAULT_EXECUTION_TIMEOUT
|
|
69
69
|
begin
|
|
70
70
|
# Set LC_ALL and LANG to force i18n to C for the duration of this exec;
|
|
71
71
|
# this ensures that any code that parses the
|
|
@@ -98,7 +98,7 @@ module Facter
|
|
|
98
98
|
message = "Failed while executing '#{command}': #{e.message}"
|
|
99
99
|
if logger
|
|
100
100
|
@log.debug(message)
|
|
101
|
-
return ''
|
|
101
|
+
return +''
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
return on_fail unless on_fail == :raise
|
|
@@ -106,6 +106,7 @@ module Facter
|
|
|
106
106
|
raise Facter::Core::Execution::ExecutionFailure.new, message
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
+
out.force_encoding(Encoding.default_external) unless out.valid_encoding?
|
|
109
110
|
[out.strip, stderr]
|
|
110
111
|
end
|
|
111
112
|
|
|
@@ -140,7 +141,7 @@ module Facter
|
|
|
140
141
|
|
|
141
142
|
def builtin_command?(command)
|
|
142
143
|
output, _status = Open3.capture2("type #{command}")
|
|
143
|
-
output.chomp
|
|
144
|
+
/builtin/.match?(output.chomp) ? true : false
|
|
144
145
|
end
|
|
145
146
|
end
|
|
146
147
|
end
|
|
@@ -11,7 +11,7 @@ module Facter
|
|
|
11
11
|
def which(bin)
|
|
12
12
|
# `echo` is allowed for facter 3.x compatibility, otherwise
|
|
13
13
|
# all commands much be found on the PATH or absolute.
|
|
14
|
-
return bin if /^echo$/i
|
|
14
|
+
return bin if /^echo$/i.match?(bin)
|
|
15
15
|
|
|
16
16
|
if absolute_path?(bin)
|
|
17
17
|
return bin if File.executable?(bin)
|
|
@@ -56,7 +56,7 @@ module Facter
|
|
|
56
56
|
|
|
57
57
|
return unless exe && (expanded = which(exe))
|
|
58
58
|
|
|
59
|
-
expanded = "\"#{expanded}\"" if
|
|
59
|
+
expanded = "\"#{expanded}\"" if /\s+/.match?(expanded)
|
|
60
60
|
expanded << " #{args}" if args
|
|
61
61
|
|
|
62
62
|
expanded
|
|
@@ -131,7 +131,7 @@ module Facter
|
|
|
131
131
|
#
|
|
132
132
|
# @param on_fail[Object] How to behave when the command could
|
|
133
133
|
# not be run. Specifying :raise will raise an error, anything else will
|
|
134
|
-
# return that object on failure. Default is
|
|
134
|
+
# return that object on failure. Default is to not raise.
|
|
135
135
|
# @param logger Optional logger used to log the command's stderr.
|
|
136
136
|
# @param timeout Optional time out for the specified command. If no timeout is passed,
|
|
137
137
|
# a default of 300 seconds is used.
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require 'facter/custom_facts/util/confine'
|
|
3
|
+
require_relative '../../../facter/custom_facts/util/fact'
|
|
4
|
+
require_relative '../../../facter/custom_facts/util/collection'
|
|
5
|
+
require_relative '../../../facter/custom_facts/util/fact'
|
|
6
|
+
require_relative '../../../facter/custom_facts/util/loader'
|
|
7
|
+
require_relative '../../../facter/custom_facts/core/execution/base'
|
|
8
|
+
require_relative '../../../facter/custom_facts/core/execution/windows'
|
|
9
|
+
require_relative '../../../facter/custom_facts/core/execution/posix'
|
|
10
|
+
require_relative '../../../facter/custom_facts/util/values'
|
|
11
|
+
require_relative '../../../facter/custom_facts/util/confine'
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
require_relative '../../../facter/custom_facts/util/config'
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
require_relative '../../../facter/custom_facts/util/normalization'
|
|
16
|
+
require_relative '../../../facter/custom_facts/core/execution'
|
|
17
|
+
require_relative '../../../facter/custom_facts/core/resolvable'
|
|
18
|
+
require_relative '../../../facter/custom_facts/core/suitable'
|
|
19
|
+
require_relative '../../../facter/custom_facts/util/resolution'
|
|
20
|
+
require_relative '../../../facter/custom_facts/core/directed_graph'
|
|
21
|
+
require_relative '../../../facter/custom_facts/core/resolvable'
|
|
22
|
+
require_relative '../../../facter/custom_facts/core/aggregate'
|
|
23
|
+
require_relative '../../../facter/custom_facts/util/composite_loader'
|
|
24
|
+
require_relative '../../../facter/custom_facts/util/parser'
|
|
25
|
+
require_relative '../../../facter/custom_facts/util/directory_loader'
|
|
26
|
+
require_relative '../../../facter/custom_facts/util/nothing_loader'
|
|
27
|
+
require_relative '../../../facter/custom_facts/util/nothing_loader'
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
require 'pathname'
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
require_relative '../../../facter/custom_facts/core/file_loader'
|
|
22
22
|
|
|
23
23
|
# Functions as a hash of 'facts' about your system system, such as MAC
|
|
24
24
|
# address, IP address, architecture, etc.
|
|
@@ -38,11 +38,7 @@ module LegacyFacter
|
|
|
38
38
|
#
|
|
39
39
|
# Attempt to normalize and validate the given string.
|
|
40
40
|
#
|
|
41
|
-
#
|
|
42
|
-
# characters and comparing the converted string to the original. If they
|
|
43
|
-
# do not match then the string is considered invalid.
|
|
44
|
-
#
|
|
45
|
-
# On Ruby 1.9+, the string is validate by checking that the string encoding
|
|
41
|
+
# The string is validated by checking that the string encoding
|
|
46
42
|
# is UTF-8 and that the string content matches the encoding. If the string
|
|
47
43
|
# is not an expected encoding then it is converted to UTF-8.
|
|
48
44
|
#
|
|
@@ -51,27 +47,16 @@ module LegacyFacter
|
|
|
51
47
|
# @param value [String]
|
|
52
48
|
# @return [void]
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def normalize_string(value)
|
|
58
|
-
converted = Iconv.conv('UTF-8//IGNORE', 'UTF-8', value)
|
|
59
|
-
raise NormalizationError, "String #{value.inspect} is not valid UTF-8" if converted != value
|
|
50
|
+
def normalize_string(value)
|
|
51
|
+
value = value.encode(Encoding::UTF_8)
|
|
60
52
|
|
|
61
|
-
|
|
53
|
+
unless value.valid_encoding?
|
|
54
|
+
raise NormalizationError, "String #{value.inspect} doesn't match the reported encoding #{value.encoding}"
|
|
62
55
|
end
|
|
63
|
-
else
|
|
64
|
-
def normalize_string(value)
|
|
65
|
-
value = value.encode(Encoding::UTF_8)
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
value
|
|
72
|
-
rescue EncodingError
|
|
73
|
-
raise NormalizationError, "String encoding #{value.encoding} is not UTF-8 and could not be converted to UTF-8"
|
|
74
|
-
end
|
|
57
|
+
value
|
|
58
|
+
rescue EncodingError
|
|
59
|
+
raise NormalizationError, "String encoding #{value.encoding} is not UTF-8 and could not be converted to UTF-8"
|
|
75
60
|
end
|
|
76
61
|
|
|
77
62
|
# Validate all elements of the array.
|
|
@@ -10,7 +10,7 @@ module Facts
|
|
|
10
10
|
def call_the_resolver
|
|
11
11
|
fact_value = Facter::Resolvers::Uname.resolve(:machine)
|
|
12
12
|
fact_value = 'amd64' if fact_value == 'x86_64'
|
|
13
|
-
fact_value = 'i386' if
|
|
13
|
+
fact_value = 'i386' if /i[3456]86|pentium/.match?(fact_value)
|
|
14
14
|
|
|
15
15
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
|
16
16
|
end
|
|
@@ -52,9 +52,9 @@ module Facts
|
|
|
52
52
|
|
|
53
53
|
return { google: true } if manufacturer == 'Google'
|
|
54
54
|
|
|
55
|
-
return { openstack: true } if
|
|
55
|
+
return { openstack: true } if /^OpenStack/.match?(manufacturer)
|
|
56
56
|
|
|
57
|
-
return { amazon: true } if
|
|
57
|
+
return { amazon: true } if /^Amazon/.match?(manufacturer)
|
|
58
58
|
|
|
59
59
|
{}
|
|
60
60
|
end
|
|
@@ -10,7 +10,7 @@ module Facts
|
|
|
10
10
|
def call_the_resolver
|
|
11
11
|
fact_value = Facter::Resolvers::Uname.resolve(:machine)
|
|
12
12
|
|
|
13
|
-
fact_value = 'i386' if
|
|
13
|
+
fact_value = 'i386' if /i[3456]86|pentium/.match?(fact_value)
|
|
14
14
|
|
|
15
15
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
|
16
16
|
end
|
|
@@ -11,6 +11,10 @@ module Facts
|
|
|
11
11
|
|
|
12
12
|
def partitions
|
|
13
13
|
parts = Facter::Resolvers::Partitions.resolve(:partitions)
|
|
14
|
+
# We should exit early if we are running on a node with no partitions
|
|
15
|
+
# (e.g. a diskless, netbooted VM)
|
|
16
|
+
return nil unless parts
|
|
17
|
+
|
|
14
18
|
mountpoints = Facter::Resolvers::Mountpoints.resolve(:mountpoints)
|
|
15
19
|
return parts unless mountpoints
|
|
16
20
|
|
|
@@ -9,16 +9,7 @@ module Facts
|
|
|
9
9
|
|
|
10
10
|
def call_the_resolver
|
|
11
11
|
fact_value = Facter::Resolvers::Uname.resolve(:processor)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[Facter::ResolvedFact.new(FACT_NAME, isa), Facter::ResolvedFact.new(ALIASES, isa, :legacy)]
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
def get_isa(fact_value)
|
|
20
|
-
value_split = fact_value.split('.')
|
|
21
|
-
value_split.last
|
|
12
|
+
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
|
22
13
|
end
|
|
23
14
|
end
|
|
24
15
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Facts
|
|
4
|
+
module Ol
|
|
5
|
+
class Lsbdistdescription
|
|
6
|
+
FACT_NAME = 'lsbdistdescription'
|
|
7
|
+
TYPE = :legacy
|
|
8
|
+
|
|
9
|
+
def call_the_resolver
|
|
10
|
+
fact_value = Facter::Resolvers::LsbRelease.resolve(:description)
|
|
11
|
+
|
|
12
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Facts
|
|
4
|
+
module Ol
|
|
5
|
+
class Lsbdistid
|
|
6
|
+
FACT_NAME = 'lsbdistid'
|
|
7
|
+
TYPE = :legacy
|
|
8
|
+
|
|
9
|
+
def call_the_resolver
|
|
10
|
+
fact_value = Facter::Resolvers::LsbRelease.resolve(:distributor_id)
|
|
11
|
+
|
|
12
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Facts
|
|
4
|
+
module Ol
|
|
5
|
+
module Os
|
|
6
|
+
module Distro
|
|
7
|
+
class Description
|
|
8
|
+
FACT_NAME = 'os.distro.description'
|
|
9
|
+
|
|
10
|
+
def call_the_resolver
|
|
11
|
+
fact_value = Facter::Resolvers::OsRelease.resolve(:pretty_name)
|
|
12
|
+
|
|
13
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Facts
|
|
4
|
+
module Ol
|
|
5
|
+
module Os
|
|
6
|
+
module Distro
|
|
7
|
+
class Id
|
|
8
|
+
FACT_NAME = 'os.distro.id'
|
|
9
|
+
|
|
10
|
+
def call_the_resolver
|
|
11
|
+
fact_value = Facter::Resolvers::OsRelease.resolve(:id).capitalize
|
|
12
|
+
|
|
13
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -27,9 +27,9 @@ module Facts
|
|
|
27
27
|
|
|
28
28
|
return { google: true } if manufacturer == 'Google'
|
|
29
29
|
|
|
30
|
-
return { openstack: true } if Facter::Resolvers::DMIComputerSystem.resolve(:name)
|
|
30
|
+
return { openstack: true } if /^OpenStack/.match?(Facter::Resolvers::DMIComputerSystem.resolve(:name))
|
|
31
31
|
|
|
32
|
-
return { amazon: true } if
|
|
32
|
+
return { amazon: true } if /^Amazon/.match?(manufacturer)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
require_relative '../../../facter/framework/logging/logger.rb'
|
|
5
5
|
Facter::Log.output(STDERR)
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
require_relative '../../../facter'
|
|
7
|
+
require_relative '../../../facter/framework/cli/cli'
|
|
8
8
|
|
|
9
9
|
class CliLauncher
|
|
10
10
|
class << self
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative '../../../facter/config'
|
|
4
4
|
|
|
5
5
|
module Facter
|
|
6
6
|
class FactGroups
|
|
@@ -64,7 +64,7 @@ module Facter
|
|
|
64
64
|
def get_fact(fact_name)
|
|
65
65
|
return @facts_ttls[fact_name] if @facts_ttls[fact_name]
|
|
66
66
|
|
|
67
|
-
result = @facts_ttls.select { |name, fact| break fact if
|
|
67
|
+
result = @facts_ttls.select { |name, fact| break fact if /^#{name}\..*/.match?(fact_name) }
|
|
68
68
|
return nil if result == {}
|
|
69
69
|
|
|
70
70
|
result
|
|
@@ -21,7 +21,19 @@ module Facter
|
|
|
21
21
|
def load(user_query, options)
|
|
22
22
|
@internal_facts = load_internal_facts(user_query, options)
|
|
23
23
|
@custom_facts = load_custom_facts(options)
|
|
24
|
-
|
|
24
|
+
if ENV['INSIDE_FACTER']
|
|
25
|
+
@log.debug('INSIDE_FACTER env var detected, not loading external facts to prevent recursion')
|
|
26
|
+
if options[:external_facts]
|
|
27
|
+
@log.warn('Recursion detected, skipping external facts. Silence this warning by adding --no-external-facts')
|
|
28
|
+
end
|
|
29
|
+
else
|
|
30
|
+
begin
|
|
31
|
+
ENV['INSIDE_FACTER'] = 'true'
|
|
32
|
+
@external_facts = load_external_facts(options)
|
|
33
|
+
ensure
|
|
34
|
+
ENV.delete('INSIDE_FACTER')
|
|
35
|
+
end
|
|
36
|
+
end
|
|
25
37
|
|
|
26
38
|
filter_env_facts
|
|
27
39
|
|
|
@@ -103,7 +115,7 @@ module Facter
|
|
|
103
115
|
|
|
104
116
|
blocked_facts.each do |blocked|
|
|
105
117
|
facts.each do |fact|
|
|
106
|
-
next unless
|
|
118
|
+
next unless /^#{blocked}\..*|^#{blocked}$/.match?(fact.name)
|
|
107
119
|
|
|
108
120
|
if fact.type == :core
|
|
109
121
|
reject_list_core << fact
|