facter 4.5.1 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/facter +1 -1
- data/lib/docs/generate.rb +1 -6
- data/lib/facter/custom_facts/core/directed_graph.rb +2 -4
- data/lib/facter/custom_facts/core/execution/base.rb +1 -1
- data/lib/facter/custom_facts/core/execution/posix.rb +6 -2
- data/lib/facter/custom_facts/core/execution/windows.rb +4 -1
- data/lib/facter/custom_facts/core/execution.rb +1 -1
- data/lib/facter/custom_facts/core/file_loader.rb +0 -4
- data/lib/facter/custom_facts/core/suitable.rb +1 -1
- data/lib/facter/custom_facts/util/collection.rb +2 -4
- data/lib/facter/custom_facts/util/confine.rb +4 -1
- data/lib/facter/custom_facts/util/fact.rb +1 -1
- data/lib/facter/custom_facts/util/loader.rb +2 -2
- data/lib/facter/custom_facts/util/resolution.rb +8 -4
- data/lib/facter/custom_facts/util/values.rb +1 -1
- data/lib/facter/facts/amzn/os/distro/release.rb +6 -1
- data/lib/facter/facts/amzn/os/release.rb +5 -0
- data/lib/facter/facts/linux/dmi/product/version.rb +19 -0
- data/lib/facter/facts/linux/kernelmajversion.rb +1 -1
- data/lib/facter/facts/macosx/is_virtual.rb +1 -1
- data/lib/facter/facts/macosx/virtual.rb +3 -3
- data/lib/facter/facts/mariner/os/release.rb +1 -1
- data/lib/facter/facts/photon/os/release.rb +1 -1
- data/lib/facter/facts/solaris/kernelmajversion.rb +1 -1
- data/lib/facter/facts/solaris/ldom.rb +1 -1
- data/lib/facter/facts/windows/hypervisors/kvm.rb +1 -1
- data/lib/facter/facts/windows/interfaces.rb +1 -1
- data/lib/facter/framework/benchmarking/timer.rb +2 -2
- data/lib/facter/framework/cli/cli.rb +6 -8
- data/lib/facter/framework/cli/cli_launcher.rb +1 -1
- data/lib/facter/framework/config/fact_groups.rb +1 -1
- data/lib/facter/framework/core/cache_manager.rb +5 -6
- data/lib/facter/framework/core/fact_loaders/class_discoverer.rb +4 -3
- data/lib/facter/framework/core/fact_loaders/fact_loader.rb +1 -3
- data/lib/facter/framework/core/fact_manager.rb +4 -4
- data/lib/facter/framework/core/file_loader.rb +736 -733
- data/lib/facter/framework/core/options/config_file_options.rb +4 -6
- data/lib/facter/framework/formatters/hocon_fact_formatter.rb +3 -2
- data/lib/facter/framework/formatters/legacy_fact_formatter.rb +4 -4
- data/lib/facter/framework/logging/logger.rb +6 -6
- data/lib/facter/framework/logging/logger_helper.rb +10 -11
- data/lib/facter/framework/parsers/query_parser.rb +24 -20
- data/lib/facter/resolvers/aix/disks.rb +1 -1
- data/lib/facter/resolvers/aix/ffi/ffi_helper.rb +1 -1
- data/lib/facter/resolvers/aix/networking.rb +1 -1
- data/lib/facter/resolvers/aix/partitions.rb +2 -2
- data/lib/facter/resolvers/aix/serialnumber.rb +1 -1
- data/lib/facter/resolvers/amzn/os_release_rpm.rb +40 -0
- data/lib/facter/resolvers/dmi.rb +2 -1
- data/lib/facter/resolvers/fips_enabled.rb +1 -1
- data/lib/facter/resolvers/freebsd/dmi.rb +1 -1
- data/lib/facter/resolvers/freebsd/swap_memory.rb +1 -1
- data/lib/facter/resolvers/freebsd/system_memory.rb +15 -7
- data/lib/facter/resolvers/freebsd/virtual.rb +1 -1
- data/lib/facter/resolvers/linux/hostname.rb +1 -1
- data/lib/facter/resolvers/macosx/dmi.rb +1 -1
- data/lib/facter/resolvers/macosx/filesystems.rb +1 -1
- data/lib/facter/resolvers/memory.rb +1 -1
- data/lib/facter/resolvers/networking.rb +3 -3
- data/lib/facter/resolvers/os_release.rb +1 -1
- data/lib/facter/resolvers/partitions.rb +2 -2
- data/lib/facter/resolvers/processors_lscpu.rb +2 -2
- data/lib/facter/resolvers/solaris/ffi/ffi.rb +2 -2
- data/lib/facter/resolvers/solaris/ffi/functions.rb +2 -2
- data/lib/facter/resolvers/solaris/mountpoints.rb +1 -1
- data/lib/facter/resolvers/solaris/networking.rb +2 -2
- data/lib/facter/resolvers/solaris/os_release.rb +2 -2
- data/lib/facter/resolvers/uname.rb +10 -6
- data/lib/facter/resolvers/virt_what.rb +2 -1
- data/lib/facter/resolvers/windows/memory.rb +3 -2
- data/lib/facter/resolvers/windows/product_release.rb +7 -7
- data/lib/facter/resolvers/xen.rb +3 -1
- data/lib/facter/util/aix/info_extractor.rb +1 -1
- data/lib/facter/util/aix/odm_query.rb +1 -1
- data/lib/facter/util/api_debugger.rb +2 -2
- data/lib/facter/util/facts/facts_utils.rb +2 -1
- data/lib/facter/util/facts/posix/virtual_detector.rb +8 -5
- data/lib/facter/util/facts/unit_converter.rb +2 -2
- data/lib/facter/util/file_helper.rb +1 -2
- data/lib/facter/util/macosx/system_profile_executor.rb +3 -3
- data/lib/facter/util/resolvers/fingerprint.rb +1 -7
- data/lib/facter/util/resolvers/networking/networking.rb +4 -3
- data/lib/facter/util/resolvers/networking/primary_interface.rb +2 -0
- data/lib/facter/util/resolvers/ssh.rb +1 -9
- data/lib/facter/util/resolvers/ssh_helper.rb +2 -0
- data/lib/facter/util/utils.rb +2 -2
- data/lib/facter/version.rb +1 -1
- data/lib/facter.rb +7 -0
- metadata +11 -9
@@ -30,7 +30,8 @@ module Facter
|
|
30
30
|
xen_info = xen_info.to_s
|
31
31
|
return 'xenu' if /xen-domu/.match?(xen_info)
|
32
32
|
return 'xenhvm' if /xen-hvm/.match?(xen_info)
|
33
|
-
|
33
|
+
|
34
|
+
'xen0' if /xen-dom0/.match?(xen_info)
|
34
35
|
end
|
35
36
|
|
36
37
|
def determine_other(output)
|
@@ -58,8 +58,9 @@ module Facter
|
|
58
58
|
@fact_list[:total_bytes] = result[:total_bytes]
|
59
59
|
@fact_list[:available_bytes] = result[:available_bytes]
|
60
60
|
@fact_list[:used_bytes] = result[:used_bytes]
|
61
|
-
@fact_list[:capacity] = format(
|
62
|
-
|
61
|
+
@fact_list[:capacity] = format(
|
62
|
+
'%<capacity>.2f%%', capacity: (result[:used_bytes] / result[:total_bytes].to_f * 100)
|
63
|
+
)
|
63
64
|
end
|
64
65
|
end
|
65
66
|
end
|
@@ -23,19 +23,19 @@ module Facter
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def build_fact_list(reg)
|
26
|
-
reg.each do |name,
|
26
|
+
reg.each do |name, value|
|
27
27
|
case name
|
28
28
|
when 'EditionID'
|
29
|
-
@fact_list[:edition_id] =
|
29
|
+
@fact_list[:edition_id] = value
|
30
30
|
when 'InstallationType'
|
31
|
-
@fact_list[:installation_type] =
|
31
|
+
@fact_list[:installation_type] = value
|
32
32
|
when 'ProductName'
|
33
|
-
@fact_list[:product_name] =
|
33
|
+
@fact_list[:product_name] = value
|
34
34
|
when 'DisplayVersion'
|
35
|
-
@fact_list[:release_id] =
|
36
|
-
@fact_list[:display_version] =
|
35
|
+
@fact_list[:release_id] = value
|
36
|
+
@fact_list[:display_version] = value
|
37
37
|
when 'ReleaseId'
|
38
|
-
@fact_list[:release_id] =
|
38
|
+
@fact_list[:release_id] = value unless @fact_list[:release_id]
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/lib/facter/resolvers/xen.rb
CHANGED
@@ -26,7 +26,9 @@ module Facter
|
|
26
26
|
|
27
27
|
def detect_xen_type
|
28
28
|
xen_type = 'xen0' if File.exist?('/dev/xen/evtchn')
|
29
|
-
|
29
|
+
if !xen_type && (File.exist?('/proc/xen') || (File.exist?('/dev/xvda1') && !File.symlink?('/dev/xvda1')))
|
30
|
+
xen_type = 'xenu'
|
31
|
+
end
|
30
32
|
|
31
33
|
xen_type
|
32
34
|
end
|
@@ -61,7 +61,7 @@ module Facter
|
|
61
61
|
properties = PROPERTIES[cmd]
|
62
62
|
properties.each do |property|
|
63
63
|
str = (properties - [property]).join('|')
|
64
|
-
matcher = content.match(
|
64
|
+
matcher = content.match(/(?:^|^[^:]+:[^:]+)#{Regexp.escape(property)}([^\n]*?)(#{str}|\n|$)/s)
|
65
65
|
if matcher
|
66
66
|
value = matcher[1].strip
|
67
67
|
property_hash[property.split(':').first] = value
|
@@ -34,9 +34,9 @@ module Facter
|
|
34
34
|
|
35
35
|
options.split(',').each do |option|
|
36
36
|
if option.start_with?('-')
|
37
|
-
exclude << option[1
|
37
|
+
exclude << option[1..].to_sym
|
38
38
|
elsif option.start_with?('+')
|
39
|
-
print_caller << option[1
|
39
|
+
print_caller << option[1..].to_sym
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -25,7 +25,7 @@ module Facter
|
|
25
25
|
os
|
26
26
|
end
|
27
27
|
|
28
|
-
def release_hash_from_string(output)
|
28
|
+
def release_hash_from_string(output, include_patch: false)
|
29
29
|
return unless output
|
30
30
|
|
31
31
|
versions = output.split('.')
|
@@ -33,6 +33,7 @@ module Facter
|
|
33
33
|
release['full'] = output
|
34
34
|
release['major'] = versions[0]
|
35
35
|
release['minor'] = versions[1] if versions[1]
|
36
|
+
release['patch'] = versions[2] if versions[2] && include_patch
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
@@ -7,11 +7,10 @@ module Facter
|
|
7
7
|
module VirtualDetector
|
8
8
|
class << self
|
9
9
|
def platform
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@@fact_value
|
10
|
+
@fact_value ||= # rubocop:disable Naming/MemoizedInstanceVariableName
|
11
|
+
check_docker_lxc || check_freebsd || check_gce || check_illumos_lx || \
|
12
|
+
retrieve_from_virt_what || check_vmware || check_open_vz || check_vserver || \
|
13
|
+
check_xen || check_other_facts || check_lspci || 'physical'
|
15
14
|
end
|
16
15
|
|
17
16
|
private
|
@@ -25,6 +24,10 @@ module Facter
|
|
25
24
|
'gce' if bios_vendor&.include?('Google')
|
26
25
|
end
|
27
26
|
|
27
|
+
def check_illumos_lx
|
28
|
+
'illumos-lx' if Facter::Resolvers::Uname.resolve(:kernelversion) == 'BrandZ virtual linux'
|
29
|
+
end
|
30
|
+
|
28
31
|
def check_vmware
|
29
32
|
Facter::Resolvers::Vmware.resolve(:vm)
|
30
33
|
end
|
@@ -19,12 +19,12 @@ module Facter
|
|
19
19
|
|
20
20
|
validated_speed, metric_prefix = determine_metric_prefix(speed)
|
21
21
|
|
22
|
-
format('%<displayed_speed>.2f', displayed_speed: validated_speed.round(2))
|
22
|
+
"#{format('%<displayed_speed>.2f', displayed_speed: validated_speed.round(2))} #{metric_prefix}Hz"
|
23
23
|
end
|
24
24
|
|
25
25
|
def bytes_to_human_readable(bytes)
|
26
26
|
return unless bytes
|
27
|
-
return bytes
|
27
|
+
return "#{bytes} bytes" if bytes < 1024
|
28
28
|
|
29
29
|
number, multiple = determine_exponent(bytes)
|
30
30
|
|
@@ -23,12 +23,12 @@ module Facter
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def output_to_hash(output)
|
26
|
-
output.scan(/.*:
|
26
|
+
output.scan(/.*: .*$/).map { |e| e.strip.match(/(.*?): (.*)/).captures }.to_h
|
27
27
|
end
|
28
28
|
|
29
29
|
def normalize_keys(system_profiler_hash)
|
30
|
-
system_profiler_hash.
|
31
|
-
|
30
|
+
system_profiler_hash.transform_keys do |k|
|
31
|
+
k.downcase.tr(' ', '_').delete("\(\)").to_sym
|
32
32
|
end.to_h
|
33
33
|
end
|
34
34
|
end
|
@@ -54,7 +54,8 @@ module Facter
|
|
54
54
|
'site'
|
55
55
|
elsif addrinfo.ipv6_loopback?
|
56
56
|
'host'
|
57
|
-
else
|
57
|
+
else
|
58
|
+
'global'
|
58
59
|
end
|
59
60
|
scope6.join
|
60
61
|
end
|
@@ -102,7 +103,7 @@ module Facter
|
|
102
103
|
def expand_interfaces(interfaces)
|
103
104
|
interfaces.each_value do |values|
|
104
105
|
expand_binding(values, values[:bindings]) if values[:bindings]
|
105
|
-
expand_binding(values, values[:bindings6], false) if values[:bindings6]
|
106
|
+
expand_binding(values, values[:bindings6], ipv4_type: false) if values[:bindings6]
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
@@ -112,7 +113,7 @@ module Facter
|
|
112
113
|
end
|
113
114
|
end
|
114
115
|
|
115
|
-
def expand_binding(values, bindings, ipv4_type
|
116
|
+
def expand_binding(values, bindings, ipv4_type: true)
|
116
117
|
binding = find_valid_binding(bindings)
|
117
118
|
ip_protocol_type = ipv4_type ? '' : '6'
|
118
119
|
|
@@ -57,6 +57,8 @@ module Facter
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def find_in_interfaces(interfaces)
|
60
|
+
return if interfaces.nil?
|
61
|
+
|
60
62
|
interfaces.each do |iface_name, interface|
|
61
63
|
interface[:bindings]&.each do |binding|
|
62
64
|
return iface_name unless Facter::Util::Resolvers::Networking.ignored_ip_address(binding[:address])
|
@@ -3,15 +3,7 @@
|
|
3
3
|
module Facter
|
4
4
|
module Util
|
5
5
|
module Resolvers
|
6
|
-
|
7
|
-
attr_accessor :fingerprint, :type, :key, :name
|
8
|
-
def initialize(fingerprint, type, key, name)
|
9
|
-
@fingerprint = fingerprint
|
10
|
-
@type = type
|
11
|
-
@key = key
|
12
|
-
@name = name
|
13
|
-
end
|
14
|
-
end
|
6
|
+
Ssh = Struct.new(:fingerprint, :type, :key, :name)
|
15
7
|
end
|
16
8
|
end
|
17
9
|
end
|
@@ -9,6 +9,7 @@ module Facter
|
|
9
9
|
class SshHelper
|
10
10
|
class << self
|
11
11
|
SSH_NAME = { 'ssh-dss' => 'dsa', 'ecdsa-sha2-nistp256' => 'ecdsa',
|
12
|
+
'ecdsa-sha2-nistp384' => 'ecdsa', 'ecdsa-sha2-nistp521' => 'ecdsa',
|
12
13
|
'ssh-ed25519' => 'ed25519', 'ssh-rsa' => 'rsa' }.freeze
|
13
14
|
SSH_FINGERPRINT = { 'rsa' => 1, 'dsa' => 2, 'ecdsa' => 3, 'ed25519' => 4 }.freeze
|
14
15
|
|
@@ -16,6 +17,7 @@ module Facter
|
|
16
17
|
key_name = SSH_NAME[key_type]
|
17
18
|
return unless key_name
|
18
19
|
|
20
|
+
# decode64 ignores non-base64 characters including newlines
|
19
21
|
decoded_key = Base64.decode64(key)
|
20
22
|
ssh_fp = SSH_FINGERPRINT[key_name]
|
21
23
|
sha1 = "SSHFP #{ssh_fp} 1 #{Digest::SHA1.new.update(decoded_key)}"
|
data/lib/facter/util/utils.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
module Facter
|
4
4
|
module Utils
|
5
5
|
# Sort nested hash.
|
6
|
-
def self.sort_hash_by_key(hash, recursive
|
6
|
+
def self.sort_hash_by_key(hash, recursive: true, &block)
|
7
7
|
hash.keys.sort(&block).each_with_object(hash.class.new) do |key, seed|
|
8
8
|
seed[key] = hash[key]
|
9
|
-
seed[key] = sort_hash_by_key(seed[key], true, &block) if recursive && seed[key].is_a?(Hash)
|
9
|
+
seed[key] = sort_hash_by_key(seed[key], recursive: true, &block) if recursive && seed[key].is_a?(Hash)
|
10
10
|
|
11
11
|
seed
|
12
12
|
end
|
data/lib/facter/version.rb
CHANGED
data/lib/facter.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -64,42 +64,42 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: '1.50'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: '1.50'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rubocop-performance
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 1.
|
81
|
+
version: '1.17'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 1.
|
88
|
+
version: '1.17'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rubocop-rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '2.20'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '2.20'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: simplecov
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -444,6 +444,7 @@ files:
|
|
444
444
|
- lib/facter/facts/linux/dmi/product/name.rb
|
445
445
|
- lib/facter/facts/linux/dmi/product/serial_number.rb
|
446
446
|
- lib/facter/facts/linux/dmi/product/uuid.rb
|
447
|
+
- lib/facter/facts/linux/dmi/product/version.rb
|
447
448
|
- lib/facter/facts/linux/ec2_metadata.rb
|
448
449
|
- lib/facter/facts/linux/ec2_userdata.rb
|
449
450
|
- lib/facter/facts/linux/facterversion.rb
|
@@ -934,6 +935,7 @@ files:
|
|
934
935
|
- lib/facter/resolvers/aix/partitions.rb
|
935
936
|
- lib/facter/resolvers/aix/processors.rb
|
936
937
|
- lib/facter/resolvers/aix/serialnumber.rb
|
938
|
+
- lib/facter/resolvers/amzn/os_release_rpm.rb
|
937
939
|
- lib/facter/resolvers/augeas.rb
|
938
940
|
- lib/facter/resolvers/az.rb
|
939
941
|
- lib/facter/resolvers/base_resolver.rb
|
@@ -1091,7 +1093,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1091
1093
|
requirements:
|
1092
1094
|
- - ">="
|
1093
1095
|
- !ruby/object:Gem::Version
|
1094
|
-
version: '2.
|
1096
|
+
version: '2.6'
|
1095
1097
|
- - "<"
|
1096
1098
|
- !ruby/object:Gem::Version
|
1097
1099
|
version: '4.0'
|