facter 4.4.1 → 4.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facter/custom_facts/util/collection.rb +3 -1
- data/lib/facter/custom_facts/util/fact.rb +1 -1
- data/lib/facter/custom_facts/util/normalization.rb +4 -0
- data/lib/facter/resolvers/augeas.rb +3 -0
- data/lib/facter/resolvers/base_resolver.rb +1 -4
- data/lib/facter/resolvers/dmi.rb +1 -1
- data/lib/facter/resolvers/os_release.rb +11 -0
- data/lib/facter/resolvers/solaris/mountpoints.rb +32 -13
- data/lib/facter/resolvers/windows/timezone.rb +1 -1
- data/lib/facter/util/resolvers/filesystem_helper.rb +1 -1
- data/lib/facter/util/resolvers/networking/networking.rb +4 -2
- data/lib/facter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c01a91258966862aa3d5b43fca18899206b64cefa3fd42446ac1c012132e90ea
|
4
|
+
data.tar.gz: 3e1c32c10e166a3dcb8ed55d709b4ce8cbe9c56b9238ed42964519caf48b82be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9f7a49e2297d1dd06b1544118e58a5cba75aa04a5991e61e3450039ff86caa934c30d1d7b584d4432a081d010be6f978f6bc6fef8cfdfa38367ec858f0a2754
|
7
|
+
data.tar.gz: c7793db89e1fd72269eba0b1f195942020a60d699374b661cd87f418be2aff38cb128ab45d0959696e696601c0bb70b7715d85c5c6404bb1aa77e9727e5f659b
|
@@ -32,7 +32,7 @@ module LegacyFacter
|
|
32
32
|
|
33
33
|
fact
|
34
34
|
rescue StandardError => e
|
35
|
-
log.log_exception(
|
35
|
+
log.log_exception(e)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Add a resolution mechanism for a named fact. This does not distinguish
|
@@ -48,6 +48,8 @@ module LegacyFacter
|
|
48
48
|
fact.add(options, &block)
|
49
49
|
|
50
50
|
fact
|
51
|
+
rescue StandardError => e
|
52
|
+
log.log_exception(e)
|
51
53
|
end
|
52
54
|
|
53
55
|
include Enumerable
|
@@ -54,6 +54,10 @@ module LegacyFacter
|
|
54
54
|
raise NormalizationError, "String #{value.inspect} doesn't match the reported encoding #{value.encoding}"
|
55
55
|
end
|
56
56
|
|
57
|
+
if value.codepoints.include?(0)
|
58
|
+
raise NormalizationError, "String #{value.inspect} contains a null byte reference; unsupported for all facts."
|
59
|
+
end
|
60
|
+
|
57
61
|
value
|
58
62
|
rescue EncodingError
|
59
63
|
raise NormalizationError, "String encoding #{value.encoding} is not UTF-8 and could not be converted to UTF-8"
|
@@ -17,6 +17,9 @@ module Facter
|
|
17
17
|
@fact_list[:augeas_version] ||= read_augeas_from_gem
|
18
18
|
|
19
19
|
@fact_list[fact_name]
|
20
|
+
rescue LoadError => e
|
21
|
+
log.debug("Resolving fact #{fact_name}, but got #{e} at #{e.backtrace[0]}")
|
22
|
+
@fact_list[:augeas_version] = nil
|
20
23
|
end
|
21
24
|
|
22
25
|
def read_augeas_from_cli
|
@@ -27,11 +27,8 @@ module Facter
|
|
27
27
|
|
28
28
|
cache_nil_for_unresolved_facts(fact_name)
|
29
29
|
end
|
30
|
-
rescue NoMethodError => e
|
31
|
-
log.debug("Could not resolve #{fact_name}, got #{e} at #{e.backtrace[0]}")
|
32
|
-
@fact_list[fact_name] = nil
|
33
30
|
rescue LoadError, NameError => e
|
34
|
-
log.
|
31
|
+
log.error("Resolving fact #{fact_name}, but got #{e} at #{e.backtrace[0]}")
|
35
32
|
@fact_list[fact_name] = nil
|
36
33
|
end
|
37
34
|
|
data/lib/facter/resolvers/dmi.rb
CHANGED
@@ -36,7 +36,7 @@ module Facter
|
|
36
36
|
return unless File.directory?('/sys/class/dmi')
|
37
37
|
|
38
38
|
file_content = Facter::Util::FileHelper.safe_read("/sys/class/dmi/id/#{fact_name}", nil)
|
39
|
-
|
39
|
+
file_content = file_content.encode('UTF-8', invalid: :replace) if file_content
|
40
40
|
if files.include?(fact_name.to_s) && file_content
|
41
41
|
file_content = file_content.strip
|
42
42
|
@fact_list[fact_name] = file_content unless file_content.empty?
|
@@ -69,17 +69,28 @@ module Facter
|
|
69
69
|
def process_id
|
70
70
|
return unless @fact_list[:id]
|
71
71
|
|
72
|
+
@fact_list[:id] = 'sles' if /sles_sap/i.match?(@fact_list[:id])
|
72
73
|
@fact_list[:id] = 'opensuse' if /opensuse/i.match?(@fact_list[:id])
|
73
74
|
end
|
74
75
|
|
75
76
|
def process_name
|
76
77
|
return unless @fact_list[:name]
|
77
78
|
|
79
|
+
normalize_os_name
|
78
80
|
join_os_name
|
79
81
|
capitalize_os_name
|
80
82
|
append_linux_to_os_name
|
81
83
|
end
|
82
84
|
|
85
|
+
def normalize_os_name
|
86
|
+
os_name = @fact_list[:name]
|
87
|
+
@fact_list[:name] = if os_name.downcase.start_with?('sles')
|
88
|
+
'SLES'
|
89
|
+
else
|
90
|
+
os_name
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
83
94
|
def join_os_name
|
84
95
|
os_name = @fact_list[:name]
|
85
96
|
@fact_list[:name] = if os_name.downcase.start_with?('red', 'oracle', 'arch', 'manjaro')
|
@@ -25,7 +25,7 @@ module Facter
|
|
25
25
|
@mounts = []
|
26
26
|
@auto_home_paths = []
|
27
27
|
|
28
|
-
Facter::Util::Resolvers::FilesystemHelper.read_mountpoints
|
28
|
+
Facter::Util::Resolvers::FilesystemHelper.read_mountpoints&.each do |fs|
|
29
29
|
if fs.name == 'auto_home'
|
30
30
|
@auto_home_paths << fs.mount_point
|
31
31
|
next
|
@@ -33,26 +33,22 @@ module Facter
|
|
33
33
|
|
34
34
|
next if fs.mount_type == 'autofs'
|
35
35
|
|
36
|
+
mounts = {}
|
36
37
|
device = fs.name
|
37
38
|
filesystem = fs.mount_type
|
38
39
|
path = fs.mount_point
|
39
40
|
options = fs.options.split(',').map(&:strip)
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
capacity = Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used_bytes, total_bytes)
|
48
|
-
|
49
|
-
size = Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes)
|
50
|
-
available = Facter::Util::Facts::UnitConverter.bytes_to_human_readable(available_bytes)
|
51
|
-
used = Facter::Util::Facts::UnitConverter.bytes_to_human_readable(used_bytes)
|
42
|
+
mounts = read_stats(path).tap do |hash|
|
43
|
+
hash[:device] = device
|
44
|
+
hash[:filesystem] = filesystem
|
45
|
+
hash[:path] = path
|
46
|
+
hash[:options] = options if options.any?
|
47
|
+
end
|
52
48
|
|
53
49
|
@mounts << Hash[Facter::Util::Resolvers::FilesystemHelper::MOUNT_KEYS
|
54
50
|
.zip(Facter::Util::Resolvers::FilesystemHelper::MOUNT_KEYS
|
55
|
-
.map { |v|
|
51
|
+
.map { |v| mounts[v] })]
|
56
52
|
end
|
57
53
|
|
58
54
|
exclude_auto_home_mounts!
|
@@ -60,6 +56,29 @@ module Facter
|
|
60
56
|
@fact_list[:mountpoints] = @mounts
|
61
57
|
@fact_list[fact_name]
|
62
58
|
end
|
59
|
+
|
60
|
+
def read_stats(path)
|
61
|
+
begin
|
62
|
+
stats = Facter::Util::Resolvers::FilesystemHelper.read_mountpoint_stats(path)
|
63
|
+
size_bytes = stats.bytes_total.abs
|
64
|
+
available_bytes = stats.bytes_available.abs
|
65
|
+
used_bytes = stats.bytes_used.abs
|
66
|
+
total_bytes = used_bytes + available_bytes
|
67
|
+
rescue Sys::Filesystem::Error
|
68
|
+
size_bytes = used_bytes = available_bytes = 0
|
69
|
+
end
|
70
|
+
|
71
|
+
{
|
72
|
+
size_bytes: size_bytes,
|
73
|
+
available_bytes: available_bytes,
|
74
|
+
used_bytes: used_bytes,
|
75
|
+
total_bytes: total_bytes,
|
76
|
+
capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used_bytes, total_bytes),
|
77
|
+
size: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes),
|
78
|
+
available: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(available_bytes),
|
79
|
+
used: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(used_bytes)
|
80
|
+
}
|
81
|
+
end
|
63
82
|
end
|
64
83
|
end
|
65
84
|
end
|
@@ -36,7 +36,9 @@ module Facter
|
|
36
36
|
interfaces = networking_facts[:interfaces]
|
37
37
|
|
38
38
|
expand_interfaces(interfaces) unless interfaces.nil?
|
39
|
-
|
39
|
+
return if primary.nil? || interfaces.nil? || networking_facts.nil?
|
40
|
+
|
41
|
+
expand_primary_interface(networking_facts, primary)
|
40
42
|
end
|
41
43
|
|
42
44
|
def get_scope(ip)
|
@@ -105,7 +107,7 @@ module Facter
|
|
105
107
|
end
|
106
108
|
|
107
109
|
def expand_primary_interface(networking_facts, primary)
|
108
|
-
networking_facts[:interfaces][primary]
|
110
|
+
networking_facts[:interfaces][primary]&.each do |key, value|
|
109
111
|
networking_facts[key] = value unless %i[bindings bindings6].include?(key)
|
110
112
|
end
|
111
113
|
end
|
data/lib/facter/version.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.
|
4
|
+
version: 4.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|