facter 4.2.3 → 4.2.4
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/loader.rb +2 -2
- data/lib/facter/resolvers/aix/disks.rb +1 -1
- data/lib/facter/resolvers/aix/mountpoints.rb +1 -1
- data/lib/facter/resolvers/aix/partitions.rb +1 -1
- data/lib/facter/resolvers/macosx/{processor.rb → processors.rb} +21 -21
- data/lib/facter/util/aix/info_extractor.rb +60 -9
- data/lib/facter/version.rb +1 -1
- data/lib/facter.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee51134133739cd64ee9fb160993ddd8ec683af8a2893aa98744709398d7ffce
|
4
|
+
data.tar.gz: d5bf29fc2338094cc267949431222af0cfa186f25998413dc6d50d14af5aafaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71a0943be14cca0cfc2a1cde31f10deae26fad0c2cc845dec8ba981e86c33b97278adc424a92b301b868fddb6213024431fec51a44f090913de58937865906ed
|
7
|
+
data.tar.gz: 13fbe6fc74dccb348d67c274861bf89fce18d4e792801546b63c4b1f260c270afc338fddf355166b27e1bef5c5484541655c70e4c8e7bfcc39468d94ae247d8e
|
@@ -141,13 +141,13 @@ module LegacyFacter
|
|
141
141
|
# Skip anything that doesn't match our regex.
|
142
142
|
next unless name =~ /^facter_?(\w+)$/i
|
143
143
|
|
144
|
-
env_name = Regexp.last_match(1)
|
144
|
+
env_name = Regexp.last_match(1).downcase
|
145
145
|
|
146
146
|
# If a fact name was specified, skip anything that doesn't
|
147
147
|
# match it.
|
148
148
|
next if fact && (env_name != fact)
|
149
149
|
|
150
|
-
LegacyFacter.add(
|
150
|
+
LegacyFacter.add(env_name, fact_type: :external, is_env: true) do
|
151
151
|
has_weight 1_000_000
|
152
152
|
setcode { value }
|
153
153
|
end
|
@@ -34,7 +34,7 @@ module Facter
|
|
34
34
|
|
35
35
|
return if stdout.empty?
|
36
36
|
|
37
|
-
info_size = Facter::Util::Aix::InfoExtractor.extract(stdout,
|
37
|
+
info_size = Facter::Util::Aix::InfoExtractor.extract(stdout, :lspv)
|
38
38
|
|
39
39
|
return unless info_size['PV STATE']
|
40
40
|
|
@@ -19,7 +19,7 @@ module Facter
|
|
19
19
|
@fact_list[:mountpoints] = {}
|
20
20
|
output = Facter::Core::Execution.execute('mount', logger: log)
|
21
21
|
output.split("\n").map do |line|
|
22
|
-
next if line =~
|
22
|
+
next if line =~ /\s+node\s+|---|procfs|ahafs/
|
23
23
|
|
24
24
|
elem = line.split("\s")
|
25
25
|
|
@@ -40,7 +40,7 @@ module Facter
|
|
40
40
|
|
41
41
|
return if stdout.empty?
|
42
42
|
|
43
|
-
info_hash = Facter::Util::Aix::InfoExtractor.extract(stdout,
|
43
|
+
info_hash = Facter::Util::Aix::InfoExtractor.extract(stdout, :lslv)
|
44
44
|
size_bytes = compute_size(info_hash)
|
45
45
|
|
46
46
|
part_info = {
|
@@ -29,42 +29,42 @@ module Facter
|
|
29
29
|
|
30
30
|
def read_processor_data(fact_name)
|
31
31
|
output = Facter::Core::Execution.execute("sysctl #{ITEMS.values.join(' ')}", logger: log)
|
32
|
-
|
32
|
+
processors_hash = Hash[*output.split("\n").collect { |v| [v.split(': ')[0], v.split(': ')[1]] }.flatten]
|
33
|
+
build_fact_list(processors_hash)
|
33
34
|
@fact_list[fact_name]
|
34
35
|
end
|
35
36
|
|
36
|
-
def build_fact_list(
|
37
|
-
build_logical_count(
|
38
|
-
build_physical_count(
|
39
|
-
build_models(
|
40
|
-
build_speed(
|
41
|
-
build_cores_per_socket(
|
42
|
-
build_threads_per_core(
|
37
|
+
def build_fact_list(hash)
|
38
|
+
build_logical_count(hash)
|
39
|
+
build_physical_count(hash)
|
40
|
+
build_models(hash)
|
41
|
+
build_speed(hash)
|
42
|
+
build_cores_per_socket(hash)
|
43
|
+
build_threads_per_core(hash)
|
43
44
|
end
|
44
45
|
|
45
|
-
def build_logical_count(
|
46
|
-
@fact_list[:logicalcount] =
|
46
|
+
def build_logical_count(hash)
|
47
|
+
@fact_list[:logicalcount] = hash[ITEMS[:logical_count]].to_i
|
47
48
|
end
|
48
49
|
|
49
|
-
def build_physical_count(
|
50
|
-
@fact_list[:physicalcount] =
|
50
|
+
def build_physical_count(hash)
|
51
|
+
@fact_list[:physicalcount] = hash[ITEMS[:physical_count]].to_i
|
51
52
|
end
|
52
53
|
|
53
|
-
def build_models(
|
54
|
-
|
55
|
-
@fact_list[:models] = Array.new(@fact_list[:logicalcount].to_i, brand)
|
54
|
+
def build_models(hash)
|
55
|
+
@fact_list[:models] = Array.new(@fact_list[:logicalcount].to_i, hash[ITEMS[:brand]])
|
56
56
|
end
|
57
57
|
|
58
|
-
def build_speed(
|
59
|
-
@fact_list[:speed] =
|
58
|
+
def build_speed(hash)
|
59
|
+
@fact_list[:speed] = hash[ITEMS[:speed]].to_i
|
60
60
|
end
|
61
61
|
|
62
|
-
def build_cores_per_socket(
|
63
|
-
@fact_list[:cores_per_socket] =
|
62
|
+
def build_cores_per_socket(hash)
|
63
|
+
@fact_list[:cores_per_socket] = hash[ITEMS[:cores_per_socket]].to_i
|
64
64
|
end
|
65
65
|
|
66
|
-
def build_threads_per_core(
|
67
|
-
@fact_list[:threads_per_core] =
|
66
|
+
def build_threads_per_core(hash)
|
67
|
+
@fact_list[:threads_per_core] = hash[ITEMS[:threads_per_core]].to_i / hash[ITEMS[:cores_per_socket]].to_i
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -6,17 +6,68 @@ module Facter
|
|
6
6
|
module InfoExtractor
|
7
7
|
MEGABYTES_EXPONENT = 1024**2
|
8
8
|
GIGABYTES_EXPONENT = 1024**3
|
9
|
+
PROPERTIES = {
|
10
|
+
lslv: [
|
11
|
+
'LOGICAL VOLUME:',
|
12
|
+
'VOLUME GROUP:',
|
13
|
+
'LV IDENTIFIER:',
|
14
|
+
'PERMISSION:',
|
15
|
+
'VG STATE:',
|
16
|
+
'LV STATE:',
|
17
|
+
'TYPE:',
|
18
|
+
'WRITE VERIFY:',
|
19
|
+
'MAX LPs:',
|
20
|
+
'PP SIZE:',
|
21
|
+
'COPIES:',
|
22
|
+
'SCHED POLICY:',
|
23
|
+
'LPs:',
|
24
|
+
'PPs:',
|
25
|
+
'STALE PPs:',
|
26
|
+
'BB POLICY:',
|
27
|
+
'INTER-POLICY:',
|
28
|
+
'RELOCATABLE:',
|
29
|
+
'INTRA-POLICY:',
|
30
|
+
'UPPER BOUND:',
|
31
|
+
'MOUNT POINT:',
|
32
|
+
'LABEL:',
|
33
|
+
'MIRROR WRITE CONSISTENCY:',
|
34
|
+
'EACH LP COPY ON A SEPARATE PV ?:',
|
35
|
+
'Serialize IO ?:'
|
36
|
+
],
|
37
|
+
lspv: [
|
38
|
+
'PHYSICAL VOLUME:',
|
39
|
+
'VOLUME GROUP:',
|
40
|
+
'PV IDENTIFIER:',
|
41
|
+
'VG IDENTIFIER',
|
42
|
+
'PV STATE:',
|
43
|
+
'STALE PARTITIONS:',
|
44
|
+
'ALLOCATABLE:',
|
45
|
+
'PP SIZE:',
|
46
|
+
'LOGICAL VOLUMES:',
|
47
|
+
'TOTAL PPs:',
|
48
|
+
'VG DESCRIPTORS:',
|
49
|
+
'FREE PPs:',
|
50
|
+
'HOT SPARE:',
|
51
|
+
'USED PPs:',
|
52
|
+
'MAX REQUEST:',
|
53
|
+
'FREE DISTRIBUTION:',
|
54
|
+
'USED DISTRIBUTION:',
|
55
|
+
'MIRROR POOL:'
|
56
|
+
]
|
57
|
+
}.freeze
|
9
58
|
|
10
|
-
def self.extract(content,
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
59
|
+
def self.extract(content, cmd)
|
60
|
+
property_hash = {}
|
61
|
+
properties = PROPERTIES[cmd]
|
62
|
+
properties.each do |property|
|
63
|
+
str = (properties - [property]).join('|')
|
64
|
+
matcher = content.match(/#{Regexp.escape(property)}([^\n]*?)(#{str}|\n|$)/s)
|
65
|
+
if matcher
|
66
|
+
value = matcher[1].strip
|
67
|
+
property_hash[property.split(':').first] = value
|
68
|
+
end
|
15
69
|
end
|
16
|
-
|
17
|
-
content.flatten!.reject!(&:nil?)
|
18
|
-
|
19
|
-
Hash[*content]
|
70
|
+
property_hash
|
20
71
|
end
|
21
72
|
end
|
22
73
|
end
|
data/lib/facter/version.rb
CHANGED
data/lib/facter.rb
CHANGED
@@ -390,7 +390,7 @@ module Facter
|
|
390
390
|
#
|
391
391
|
# @api public
|
392
392
|
def value(user_query)
|
393
|
-
user_query = user_query.to_s
|
393
|
+
user_query = user_query.to_s.downcase
|
394
394
|
resolve_fact(user_query)
|
395
395
|
|
396
396
|
@already_searched[user_query]&.value
|
@@ -407,7 +407,7 @@ module Facter
|
|
407
407
|
#
|
408
408
|
# @api public
|
409
409
|
def fact(user_query)
|
410
|
-
user_query = user_query.to_s
|
410
|
+
user_query = user_query.to_s.downcase
|
411
411
|
resolve_fact(user_query)
|
412
412
|
|
413
413
|
@already_searched[user_query]
|
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.2.
|
4
|
+
version: 4.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -964,7 +964,7 @@ files:
|
|
964
964
|
- lib/facter/resolvers/macosx/filesystems.rb
|
965
965
|
- lib/facter/resolvers/macosx/load_averages.rb
|
966
966
|
- lib/facter/resolvers/macosx/mountpoints.rb
|
967
|
-
- lib/facter/resolvers/macosx/
|
967
|
+
- lib/facter/resolvers/macosx/processors.rb
|
968
968
|
- lib/facter/resolvers/macosx/swap_memory.rb
|
969
969
|
- lib/facter/resolvers/macosx/system_memory.rb
|
970
970
|
- lib/facter/resolvers/macosx/system_profiler.rb
|