facter 4.0.36 → 4.0.37
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/directory_loader.rb +9 -1
- data/lib/facter/custom_facts/util/fact.rb +4 -1
- data/lib/facter/facts/linux/partitions.rb +1 -1
- data/lib/facter/facts/ubuntu/lsbdistrelease.rb +23 -0
- data/lib/facter/framework/benchmarking/timer.rb +23 -0
- data/lib/facter/framework/cli/cli.rb +5 -0
- data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +2 -1
- data/lib/facter/framework/core/fact_loaders/internal_fact_loader.rb +7 -7
- data/lib/facter/framework/core/file_loader.rb +2 -0
- data/lib/facter/framework/core/options/option_store.rb +3 -1
- data/lib/facter/framework/core/session_cache.rb +1 -4
- data/lib/facter/resolvers/aio_agent_version.rb +0 -1
- data/lib/facter/resolvers/aix/architecture_resolver.rb +0 -1
- data/lib/facter/resolvers/aix/disks.rb +2 -3
- data/lib/facter/resolvers/aix/filesystem_resolver.rb +0 -1
- data/lib/facter/resolvers/aix/hardware_resolver.rb +0 -1
- data/lib/facter/resolvers/aix/load_averages_resolver.rb +0 -1
- data/lib/facter/resolvers/aix/memory.rb +2 -3
- data/lib/facter/resolvers/aix/mountpoints.rb +0 -1
- data/lib/facter/resolvers/aix/networking_resolver.rb +0 -1
- data/lib/facter/resolvers/aix/nim.rb +0 -1
- data/lib/facter/resolvers/aix/os_level_resolver.rb +0 -1
- data/lib/facter/resolvers/aix/partitions.rb +2 -3
- data/lib/facter/resolvers/aix/processors.rb +0 -1
- data/lib/facter/resolvers/aix/serialnumber.rb +0 -1
- data/lib/facter/resolvers/augeas_resolver.rb +0 -1
- data/lib/facter/resolvers/base_resolver.rb +9 -4
- data/lib/facter/resolvers/bsd/processors.rb +0 -1
- data/lib/facter/resolvers/containers.rb +0 -1
- data/lib/facter/resolvers/debian_version.rb +0 -1
- data/lib/facter/resolvers/disk_resolver.rb +0 -1
- data/lib/facter/resolvers/dmi_decode.rb +0 -1
- data/lib/facter/resolvers/dmi_resolver.rb +0 -1
- data/lib/facter/resolvers/ec2.rb +0 -1
- data/lib/facter/resolvers/eos_release_resolver.rb +0 -1
- data/lib/facter/resolvers/facterversion_resolver.rb +0 -1
- data/lib/facter/resolvers/filesystems_resolver.rb +0 -1
- data/lib/facter/resolvers/fips_enabled_resolver.rb +0 -1
- data/lib/facter/resolvers/freebsd/dmi_resolver.rb +0 -1
- data/lib/facter/resolvers/freebsd/freebsd_version_resolver.rb +0 -1
- data/lib/facter/resolvers/freebsd/geom_resolver.rb +0 -1
- data/lib/facter/resolvers/freebsd/processors.rb +0 -1
- data/lib/facter/resolvers/freebsd/swap_memory_resolver.rb +0 -1
- data/lib/facter/resolvers/freebsd/system_memory_resolver.rb +0 -1
- data/lib/facter/resolvers/gce.rb +0 -1
- data/lib/facter/resolvers/hostname_resolver.rb +0 -1
- data/lib/facter/resolvers/identity_resolver.rb +0 -1
- data/lib/facter/resolvers/linux/docker_uptime.rb +0 -1
- data/lib/facter/resolvers/linux/load_averages.rb +0 -1
- data/lib/facter/resolvers/load_averages.rb +0 -1
- data/lib/facter/resolvers/lpar_resolver.rb +0 -1
- data/lib/facter/resolvers/lsb_release_resolver.rb +0 -1
- data/lib/facter/resolvers/lspci.rb +0 -1
- data/lib/facter/resolvers/macosx/dmi_resolver.rb +0 -1
- data/lib/facter/resolvers/macosx/filesystems_resolver.rb +1 -6
- data/lib/facter/resolvers/macosx/load_averages_resolver.rb +0 -1
- data/lib/facter/resolvers/macosx/mountpoints_resolver.rb +3 -3
- data/lib/facter/resolvers/macosx/processor_resolver.rb +0 -1
- data/lib/facter/resolvers/macosx/swap_memory_resolver.rb +0 -1
- data/lib/facter/resolvers/macosx/system_memory_resolver.rb +0 -1
- data/lib/facter/resolvers/macosx/system_profiler_resolver.rb +0 -1
- data/lib/facter/resolvers/memory_resolver.rb +6 -2
- data/lib/facter/resolvers/mountpoints_resolver.rb +0 -1
- data/lib/facter/resolvers/networking_linux_resolver.rb +0 -1
- data/lib/facter/resolvers/networking_resolver.rb +0 -1
- data/lib/facter/resolvers/open_vz.rb +0 -1
- data/lib/facter/resolvers/os_level_resolver.rb +0 -1
- data/lib/facter/resolvers/os_release_resolver.rb +0 -1
- data/lib/facter/resolvers/partitions.rb +37 -2
- data/lib/facter/resolvers/path_resolver.rb +0 -1
- data/lib/facter/resolvers/processors_resolver.rb +0 -1
- data/lib/facter/resolvers/puppet_version_resolver.rb +0 -1
- data/lib/facter/resolvers/redhat_release_resolver.rb +0 -1
- data/lib/facter/resolvers/ruby_resolver.rb +0 -1
- data/lib/facter/resolvers/selinux_resolver.rb +0 -1
- data/lib/facter/resolvers/solaris/disks.rb +0 -1
- data/lib/facter/resolvers/solaris/dmi.rb +0 -1
- data/lib/facter/resolvers/solaris/dmi_sparc.rb +0 -1
- data/lib/facter/resolvers/solaris/filesystems.rb +0 -1
- data/lib/facter/resolvers/solaris/ipaddress.rb +0 -1
- data/lib/facter/resolvers/solaris/ldom.rb +0 -1
- data/lib/facter/resolvers/solaris/memory.rb +0 -1
- data/lib/facter/resolvers/solaris/networking.rb +0 -1
- data/lib/facter/resolvers/solaris/os_release.rb +0 -1
- data/lib/facter/resolvers/solaris/processors.rb +0 -1
- data/lib/facter/resolvers/solaris/zone.rb +0 -1
- data/lib/facter/resolvers/solaris/zone_name.rb +0 -1
- data/lib/facter/resolvers/ssh_resolver.rb +0 -1
- data/lib/facter/resolvers/suse_release_resolver.rb +0 -1
- data/lib/facter/resolvers/sw_vers_resolver.rb +0 -1
- data/lib/facter/resolvers/timezone_resolver.rb +0 -1
- data/lib/facter/resolvers/uname_resolver.rb +0 -1
- data/lib/facter/resolvers/uptime_resolver.rb +0 -1
- data/lib/facter/resolvers/virt_what.rb +0 -1
- data/lib/facter/resolvers/vmware.rb +0 -1
- data/lib/facter/resolvers/windows/aio_agent_version.rb +0 -1
- data/lib/facter/resolvers/windows/dmi_bios_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/dmi_computersystem_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/fips_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/hardware_architecture_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/identity_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/kernel_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/memory_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/netkvm_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/networking_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/processors_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/product_release_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/ssh.rb +0 -1
- data/lib/facter/resolvers/windows/system32_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/uptime_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/virtualization_resolver.rb +0 -1
- data/lib/facter/resolvers/windows/win_os_description_resolver.rb +0 -1
- data/lib/facter/resolvers/wpar_resolver.rb +0 -1
- data/lib/facter/resolvers/xen.rb +0 -1
- data/lib/facter/resolvers/zfs.rb +0 -1
- data/lib/facter/resolvers/zpool.rb +0 -1
- data/lib/facter/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2ed5162fef26cfbf5bd010cf7737ac8b4856cf59f9f55745d6cfc1bec39781e
|
4
|
+
data.tar.gz: 761beee20f449b3bbe1e5dc35c0bcd675e9602902804e7add3ee6c3d31a8916d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92751ef6452023c4e4edd9c2b7d21bd78bef74404d5550d4de353b4243f6639f29abbba1f00d6f8ba0b4bbf7afbea060f00aa34919a2d1d94459e1df5515e706
|
7
|
+
data.tar.gz: b4ca79c0907439874ae638a920def98b9ed0d3e2893a77b6bc3d44dfb3cba756f88e550d55d14a8e4cdb9d2c5b58a6d0c6a6c335955ae819607021a80562cd65
|
@@ -84,7 +84,7 @@ module LegacyFacter
|
|
84
84
|
parser = LegacyFacter::Util::Parser.parser_for(fact.file)
|
85
85
|
next if parser.nil?
|
86
86
|
|
87
|
-
data = parser
|
87
|
+
data = resolve_fact(fact, parser)
|
88
88
|
|
89
89
|
if data == false
|
90
90
|
LegacyFacter.warn "Could not interpret fact file #{fact.file}"
|
@@ -99,6 +99,14 @@ module LegacyFacter
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
def resolve_fact(fact, parser)
|
103
|
+
data = nil
|
104
|
+
fact_name = File.basename(fact.file)
|
105
|
+
Facter::Framework::Benchmarking::Timer.measure(fact_name) { data = parser.results }
|
106
|
+
|
107
|
+
data
|
108
|
+
end
|
109
|
+
|
102
110
|
def entries
|
103
111
|
dirs = @directories.select { |directory| File.directory?(directory) }.map do |directory|
|
104
112
|
Dir.entries(directory).map { |directory_entry| File.join(directory, directory_entry) }
|
@@ -118,7 +118,10 @@ module Facter
|
|
118
118
|
|
119
119
|
searching do
|
120
120
|
suitable_resolutions = sort_by_weight(find_suitable_resolutions(@resolves))
|
121
|
-
|
121
|
+
|
122
|
+
Facter::Framework::Benchmarking::Timer.measure(@name) do
|
123
|
+
@value = find_first_real_value(suitable_resolutions)
|
124
|
+
end
|
122
125
|
|
123
126
|
announce_when_no_suitable_resolution(suitable_resolutions)
|
124
127
|
announce_when_no_value_found(@value)
|
@@ -14,7 +14,7 @@ module Facts
|
|
14
14
|
mountpoints = Facter::Resolvers::Mountpoints.resolve(:mountpoints)
|
15
15
|
return parts unless mountpoints
|
16
16
|
|
17
|
-
mountpoints.
|
17
|
+
mountpoints.reverse_each do |mnt|
|
18
18
|
next unless parts[mnt[:device]]
|
19
19
|
|
20
20
|
parts[mnt[:device]].merge!(mount: mnt[:path])
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Ubuntu
|
5
|
+
class Lsbdistrelease
|
6
|
+
FACT_NAME = 'lsbdistrelease'
|
7
|
+
ALIASES = %w[lsbmajdistrelease lsbminordistrelease].freeze
|
8
|
+
TYPE = :legacy
|
9
|
+
|
10
|
+
def call_the_resolver
|
11
|
+
fact_value = Facter::Resolvers::LsbRelease.resolve(:release)
|
12
|
+
|
13
|
+
return Facter::ResolvedFact.new(FACT_NAME, nil, :legacy) unless fact_value
|
14
|
+
|
15
|
+
version = fact_value.split('.')
|
16
|
+
|
17
|
+
[Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy),
|
18
|
+
Facter::ResolvedFact.new(ALIASES[0], version[0], :legacy),
|
19
|
+
Facter::ResolvedFact.new(ALIASES[1], version[1], :legacy)]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'benchmark'
|
4
|
+
|
5
|
+
module Facter
|
6
|
+
module Framework
|
7
|
+
module Benchmarking
|
8
|
+
class Timer
|
9
|
+
class << self
|
10
|
+
def measure(fact_name)
|
11
|
+
if Options[:timing]
|
12
|
+
time = Benchmark.measure { yield }
|
13
|
+
|
14
|
+
puts "fact `#{fact_name}`, took: #{time.format('%r')} seconds"
|
15
|
+
else
|
16
|
+
yield
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -108,6 +108,11 @@ module Facter
|
|
108
108
|
aliases: '-p',
|
109
109
|
desc: 'Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.'
|
110
110
|
|
111
|
+
class_option :timing,
|
112
|
+
type: :boolean,
|
113
|
+
aliases: '-t',
|
114
|
+
desc: 'Show how much time it took to resolve each fact'
|
115
|
+
|
111
116
|
desc '--man', 'Manual', hide: true
|
112
117
|
map ['--man'] => :man
|
113
118
|
def man(*args)
|
@@ -36,7 +36,8 @@ module Facter
|
|
36
36
|
.each do |searched_fact|
|
37
37
|
begin
|
38
38
|
fact = CoreFact.new(searched_fact)
|
39
|
-
fact_value =
|
39
|
+
fact_value = nil
|
40
|
+
Facter::Framework::Benchmarking::Timer.measure(searched_fact.name) { fact_value = fact.create }
|
40
41
|
resolved_facts << fact_value unless fact_value.nil?
|
41
42
|
rescue StandardError => e
|
42
43
|
@@log.log_exception(e)
|
@@ -30,18 +30,18 @@ module Facter
|
|
30
30
|
def load_for_os(operating_system)
|
31
31
|
# select only classes
|
32
32
|
classes = ClassDiscoverer.instance.discover_classes(operating_system)
|
33
|
-
|
34
33
|
classes.each do |class_name|
|
35
34
|
fact_name = class_name::FACT_NAME
|
36
|
-
|
37
35
|
# if fact is already loaded, skip it
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
unless @facts.any? { |fact| fact.name == fact_name }
|
37
|
+
type = class_name.const_defined?('TYPE') ? class_name::TYPE : :core
|
38
|
+
load_fact(fact_name, class_name, type)
|
39
|
+
end
|
42
40
|
next unless class_name.const_defined?('ALIASES')
|
43
41
|
|
44
|
-
[*class_name::ALIASES].each
|
42
|
+
[*class_name::ALIASES].each do |fact_alias|
|
43
|
+
load_fact(fact_alias, class_name, :legacy) unless @facts.any? { |fact| fact.name == fact_alias }
|
44
|
+
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -39,6 +39,8 @@ load_dir(['resolvers'])
|
|
39
39
|
load_dir(['facts_utils'])
|
40
40
|
load_dir(%w[framework core])
|
41
41
|
load_dir(['models'])
|
42
|
+
load_dir(%w[framework benchmarking])
|
43
|
+
|
42
44
|
load_dir(%w[framework core fact_loaders])
|
43
45
|
load_dir(%w[framework core fact internal])
|
44
46
|
load_dir(%w[framework core fact external])
|
@@ -23,6 +23,7 @@ module Facter
|
|
23
23
|
@block_list = {}
|
24
24
|
@fact_groups = {}
|
25
25
|
@color = false
|
26
|
+
@timing = false
|
26
27
|
|
27
28
|
class << self
|
28
29
|
attr_reader :debug, :verbose, :log_level, :show_legacy, :ruby,
|
@@ -31,7 +32,7 @@ module Facter
|
|
31
32
|
attr_accessor :config, :user_query, :strict, :json, :haml, :external_facts,
|
32
33
|
:cache, :yaml, :puppet, :ttls, :block, :cli, :config_file_custom_dir,
|
33
34
|
:config_file_external_dir, :default_external_dir, :fact_groups,
|
34
|
-
:block_list, :color, :trace
|
35
|
+
:block_list, :color, :trace, :timing
|
35
36
|
|
36
37
|
attr_writer :external_dir
|
37
38
|
|
@@ -159,6 +160,7 @@ module Facter
|
|
159
160
|
@blocked_facts = []
|
160
161
|
@fact_groups = {}
|
161
162
|
@block_list = {}
|
163
|
+
@timing = false
|
162
164
|
end
|
163
165
|
|
164
166
|
def fallback_external_dir
|
@@ -4,7 +4,6 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Disks < BaseResolver
|
7
|
-
@semaphore = Mutex.new
|
8
7
|
@fact_list ||= {}
|
9
8
|
class << self
|
10
9
|
private
|
@@ -14,12 +13,12 @@ module Facter
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def execute_lspv(fact_name)
|
17
|
-
@fact_list[:disks] = {}
|
18
|
-
|
19
16
|
result = Facter::Core::Execution.execute('lspv', logger: log)
|
20
17
|
|
21
18
|
return if result.empty?
|
22
19
|
|
20
|
+
@fact_list[:disks] = {}
|
21
|
+
|
23
22
|
result.each_line do |line|
|
24
23
|
disk_name = line.split(' ')[0].strip
|
25
24
|
size = find_size(disk_name)
|
@@ -5,7 +5,6 @@ module Facter
|
|
5
5
|
module Aix
|
6
6
|
class Memory < BaseResolver
|
7
7
|
# :hardware
|
8
|
-
@semaphore = Mutex.new
|
9
8
|
@fact_list ||= {}
|
10
9
|
class << self
|
11
10
|
private
|
@@ -18,11 +17,11 @@ module Facter
|
|
18
17
|
result = Facter::Core::Execution.execute('svmon', logger: log)
|
19
18
|
return if result.empty?
|
20
19
|
|
21
|
-
@fact_list[:system] = @fact_list[:swap] = {}
|
22
|
-
|
23
20
|
pagesize = call_pagesize.to_i
|
24
21
|
return if pagesize.zero?
|
25
22
|
|
23
|
+
@fact_list[:system] = @fact_list[:swap] = {}
|
24
|
+
|
26
25
|
result.each_line do |line|
|
27
26
|
@fact_list[:system] = populate_system(line, pagesize) if line.include?('memory')
|
28
27
|
@fact_list[:swap] = populate_swap(line, pagesize) if line =~ /pg\sspace/
|
@@ -4,7 +4,6 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Partitions < BaseResolver
|
7
|
-
@semaphore = Mutex.new
|
8
7
|
@fact_list ||= {}
|
9
8
|
class << self
|
10
9
|
private
|
@@ -14,8 +13,6 @@ module Facter
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def query_cudv(fact_name)
|
17
|
-
@fact_list[:partitions] = {}
|
18
|
-
|
19
16
|
odmquery = Facter::ODMQuery.new
|
20
17
|
odmquery.equals('PdDvLn', 'logical_volume/lvsubclass/lvtype')
|
21
18
|
|
@@ -23,6 +20,8 @@ module Facter
|
|
23
20
|
|
24
21
|
return unless result
|
25
22
|
|
23
|
+
@fact_list[:partitions] = {}
|
24
|
+
|
26
25
|
result.each_line do |line|
|
27
26
|
next unless line.include?('name')
|
28
27
|
|
@@ -16,15 +16,20 @@ module Facter
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.resolve(fact_name)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
subscribe_to_manager
|
20
|
+
post_resolve(fact_name)
|
21
|
+
|
22
|
+
validate_resolution(fact_name)
|
23
23
|
rescue LoadError, NameError => e
|
24
24
|
log.debug("resolving fact #{fact_name}, but #{e}")
|
25
25
|
@fact_list[fact_name] = nil
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.validate_resolution(fact_name)
|
29
|
+
@fact_list.fetch(fact_name) { @fact_list[fact_name] = nil }
|
30
|
+
@fact_list[fact_name]
|
31
|
+
end
|
32
|
+
|
28
33
|
def self.post_resolve(_fact_name)
|
29
34
|
raise NotImplementedError, "You must implement post_resolve(fact_name) method in #{name}"
|
30
35
|
end
|