facterdb 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +8 -31
- data/CHANGELOG.md +16 -0
- data/facts/4.2/archlinux-x86_64.facts +13 -2
- data/facts/4.3/archlinux-x86_64.facts +13 -2
- data/facts/4.4/archlinux-x86_64.facts +13 -2
- data/facts/4.5/archlinux-x86_64.facts +13 -2
- data/facts/4.6/archlinux-x86_64.facts +13 -2
- data/facts/4.7/archlinux-x86_64.facts +13 -2
- data/lib/facterdb/version.rb +1 -1
- data/lib/facterdb.rb +6 -2
- data/spec/facter_db_spec.rb +22 -1
- data/spec/facts_spec.rb +8 -0
- 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: 75843f09832f669272fcb7ea1f32d09f931c0ec55e4603e34593ad24ebc80d25
|
4
|
+
data.tar.gz: ad00ec7cf7ca4a579c2ec918312e18d2b16634e5720aed4a94bb8cdbce0bbf65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d8145338782bcb755d72bc58ace5285d5ac340ff6252598f04ad4cf95d1648d373afa5b602bf94c942e972c5d43ba1ff1f4e167f41c22c023d0795fe631062d
|
7
|
+
data.tar.gz: fe5f1c7347394dad0505a9c2429dce5f0ece8beb6ab1679b82b8e269ecac8dc309cf7c42f158c1628b1f721c59acdb39097cdb934e2b96bcc41fdbbe42d55bff
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2024-06-08 21:54:16 UTC using RuboCop version 1.63.5.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -20,11 +20,12 @@ Lint/SuppressedException:
|
|
20
20
|
|
21
21
|
# Offense count: 3
|
22
22
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
23
|
+
# Configuration parameters: AutoCorrect.
|
23
24
|
Lint/UselessAssignment:
|
24
25
|
Exclude:
|
25
26
|
- 'spec/facts_spec.rb'
|
26
27
|
|
27
|
-
# Offense count:
|
28
|
+
# Offense count: 3
|
28
29
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
29
30
|
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
30
31
|
Naming/MethodParameterName:
|
@@ -38,7 +39,7 @@ Performance/MapCompact:
|
|
38
39
|
Exclude:
|
39
40
|
- 'lib/facterdb.rb'
|
40
41
|
|
41
|
-
# Offense count:
|
42
|
+
# Offense count: 8
|
42
43
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
43
44
|
Performance/StringInclude:
|
44
45
|
Exclude:
|
@@ -64,7 +65,7 @@ RSpec/DescribeClass:
|
|
64
65
|
|
65
66
|
# Offense count: 12
|
66
67
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
67
|
-
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
68
|
+
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
|
68
69
|
# SupportedStyles: described_class, explicit
|
69
70
|
RSpec/DescribedClass:
|
70
71
|
Exclude:
|
@@ -79,7 +80,7 @@ RSpec/ExampleLength:
|
|
79
80
|
RSpec/MultipleExpectations:
|
80
81
|
Max: 7
|
81
82
|
|
82
|
-
# Offense count:
|
83
|
+
# Offense count: 19
|
83
84
|
# Configuration parameters: AllowSubject.
|
84
85
|
RSpec/MultipleMemoizedHelpers:
|
85
86
|
Max: 6
|
@@ -114,7 +115,7 @@ Style/Documentation:
|
|
114
115
|
- 'lib/facterdb.rb'
|
115
116
|
- 'lib/facterdb/bin.rb'
|
116
117
|
|
117
|
-
# Offense count:
|
118
|
+
# Offense count: 12
|
118
119
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
119
120
|
# Configuration parameters: EnforcedStyle.
|
120
121
|
# SupportedStyles: always, always_true, never
|
@@ -141,24 +142,6 @@ Style/HashEachMethods:
|
|
141
142
|
Exclude:
|
142
143
|
- 'spec/facts_spec.rb'
|
143
144
|
|
144
|
-
# Offense count: 1
|
145
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
146
|
-
Style/HashTransformKeys:
|
147
|
-
Exclude:
|
148
|
-
- 'lib/facterdb.rb'
|
149
|
-
|
150
|
-
# Offense count: 1
|
151
|
-
# This cop supports safe autocorrection (--autocorrect).
|
152
|
-
Style/IfUnlessModifier:
|
153
|
-
Exclude:
|
154
|
-
- 'lib/facterdb.rb'
|
155
|
-
|
156
|
-
# Offense count: 1
|
157
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
158
|
-
Style/MapToHash:
|
159
|
-
Exclude:
|
160
|
-
- 'lib/facterdb.rb'
|
161
|
-
|
162
145
|
# Offense count: 1
|
163
146
|
Style/MixinUsage:
|
164
147
|
Exclude:
|
@@ -189,12 +172,6 @@ Style/OptionalBooleanParameter:
|
|
189
172
|
Exclude:
|
190
173
|
- 'lib/facterdb.rb'
|
191
174
|
|
192
|
-
# Offense count: 1
|
193
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
194
|
-
Style/SlicingWithRange:
|
195
|
-
Exclude:
|
196
|
-
- 'Rakefile'
|
197
|
-
|
198
175
|
# Offense count: 1
|
199
176
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
200
177
|
# Configuration parameters: Mode.
|
@@ -215,4 +192,4 @@ Style/SymbolProc:
|
|
215
192
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
216
193
|
# URISchemes: http, https
|
217
194
|
Layout/LineLength:
|
218
|
-
Max:
|
195
|
+
Max: 154
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.1.0](https://rubygems.org/gems/facterdb/versions/2.1.0) (2024-06-08)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/voxpupuli/facterdb/compare/2.0.1...2.1.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Make symbolize keys optional [\#364](https://github.com/voxpupuli/facterdb/pull/364) ([bastelfreak](https://github.com/bastelfreak))
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- Fix Arch Linux factsets [\#366](https://github.com/voxpupuli/facterdb/pull/366) ([bastelfreak](https://github.com/bastelfreak))
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- Add tests for OS core facts [\#367](https://github.com/voxpupuli/facterdb/pull/367) ([bastelfreak](https://github.com/bastelfreak))
|
18
|
+
|
3
19
|
## [2.0.1](https://rubygems.org/gems/facterdb/versions/2.0.1) (2024-05-28)
|
4
20
|
|
5
21
|
[Full Changelog](https://github.com/voxpupuli/facterdb/compare/2.0.0...2.0.1)
|
@@ -427,12 +427,23 @@
|
|
427
427
|
"operatingsystem": "Archlinux",
|
428
428
|
"os": {
|
429
429
|
"architecture": "x86_64",
|
430
|
+
"distro": {
|
431
|
+
"codename": "n/a",
|
432
|
+
"description": "Arch Linux",
|
433
|
+
"id": "Arch",
|
434
|
+
"release": {
|
435
|
+
"full": "rolling",
|
436
|
+
"major": "rolling"
|
437
|
+
},
|
438
|
+
"specification": "n/a"
|
439
|
+
},
|
430
440
|
"family": "Archlinux",
|
431
441
|
"hardware": "x86_64",
|
432
442
|
"name": "Archlinux",
|
433
443
|
"release": {
|
434
|
-
"full":
|
435
|
-
"major":
|
444
|
+
"full": "6.8.7-hardened1-2-hardened",
|
445
|
+
"major": "6",
|
446
|
+
"minor": "8"
|
436
447
|
},
|
437
448
|
"selinux": {
|
438
449
|
"enabled": false
|
@@ -427,12 +427,23 @@
|
|
427
427
|
"operatingsystem": "Archlinux",
|
428
428
|
"os": {
|
429
429
|
"architecture": "x86_64",
|
430
|
+
"distro": {
|
431
|
+
"codename": "n/a",
|
432
|
+
"description": "Arch Linux",
|
433
|
+
"id": "Arch",
|
434
|
+
"release": {
|
435
|
+
"full": "rolling",
|
436
|
+
"major": "rolling"
|
437
|
+
},
|
438
|
+
"specification": "n/a"
|
439
|
+
},
|
430
440
|
"family": "Archlinux",
|
431
441
|
"hardware": "x86_64",
|
432
442
|
"name": "Archlinux",
|
433
443
|
"release": {
|
434
|
-
"full":
|
435
|
-
"major":
|
444
|
+
"full": "6.8.7-hardened1-2-hardened",
|
445
|
+
"major": "6",
|
446
|
+
"minor": "8"
|
436
447
|
},
|
437
448
|
"selinux": {
|
438
449
|
"enabled": false
|
@@ -427,12 +427,23 @@
|
|
427
427
|
"operatingsystem": "Archlinux",
|
428
428
|
"os": {
|
429
429
|
"architecture": "x86_64",
|
430
|
+
"distro": {
|
431
|
+
"codename": "n/a",
|
432
|
+
"description": "Arch Linux",
|
433
|
+
"id": "Arch",
|
434
|
+
"release": {
|
435
|
+
"full": "rolling",
|
436
|
+
"major": "rolling"
|
437
|
+
},
|
438
|
+
"specification": "n/a"
|
439
|
+
},
|
430
440
|
"family": "Archlinux",
|
431
441
|
"hardware": "x86_64",
|
432
442
|
"name": "Archlinux",
|
433
443
|
"release": {
|
434
|
-
"full":
|
435
|
-
"major":
|
444
|
+
"full": "6.8.7-hardened1-2-hardened",
|
445
|
+
"major": "6",
|
446
|
+
"minor": "8"
|
436
447
|
},
|
437
448
|
"selinux": {
|
438
449
|
"enabled": false
|
@@ -433,12 +433,23 @@
|
|
433
433
|
"operatingsystem": "Archlinux",
|
434
434
|
"os": {
|
435
435
|
"architecture": "x86_64",
|
436
|
+
"distro": {
|
437
|
+
"codename": "n/a",
|
438
|
+
"description": "Arch Linux",
|
439
|
+
"id": "Arch",
|
440
|
+
"release": {
|
441
|
+
"full": "rolling",
|
442
|
+
"major": "rolling"
|
443
|
+
},
|
444
|
+
"specification": "n/a"
|
445
|
+
},
|
436
446
|
"family": "Archlinux",
|
437
447
|
"hardware": "x86_64",
|
438
448
|
"name": "Archlinux",
|
439
449
|
"release": {
|
440
|
-
"full":
|
441
|
-
"major":
|
450
|
+
"full": "6.8.7-hardened1-2-hardened",
|
451
|
+
"major": "6",
|
452
|
+
"minor": "8"
|
442
453
|
},
|
443
454
|
"selinux": {
|
444
455
|
"enabled": false
|
@@ -434,12 +434,23 @@
|
|
434
434
|
"operatingsystem": "Archlinux",
|
435
435
|
"os": {
|
436
436
|
"architecture": "x86_64",
|
437
|
+
"distro": {
|
438
|
+
"codename": "n/a",
|
439
|
+
"description": "Arch Linux",
|
440
|
+
"id": "Arch",
|
441
|
+
"release": {
|
442
|
+
"full": "rolling",
|
443
|
+
"major": "rolling"
|
444
|
+
},
|
445
|
+
"specification": "n/a"
|
446
|
+
},
|
437
447
|
"family": "Archlinux",
|
438
448
|
"hardware": "x86_64",
|
439
449
|
"name": "Archlinux",
|
440
450
|
"release": {
|
441
|
-
"full":
|
442
|
-
"major":
|
451
|
+
"full": "6.8.7-hardened1-2-hardened",
|
452
|
+
"major": "6",
|
453
|
+
"minor": "8"
|
443
454
|
},
|
444
455
|
"selinux": {
|
445
456
|
"enabled": false
|
@@ -434,12 +434,23 @@
|
|
434
434
|
"operatingsystem": "Archlinux",
|
435
435
|
"os": {
|
436
436
|
"architecture": "x86_64",
|
437
|
+
"distro": {
|
438
|
+
"codename": "n/a",
|
439
|
+
"description": "Arch Linux",
|
440
|
+
"id": "Arch",
|
441
|
+
"release": {
|
442
|
+
"full": "rolling",
|
443
|
+
"major": "rolling"
|
444
|
+
},
|
445
|
+
"specification": "n/a"
|
446
|
+
},
|
437
447
|
"family": "Archlinux",
|
438
448
|
"hardware": "x86_64",
|
439
449
|
"name": "Archlinux",
|
440
450
|
"release": {
|
441
|
-
"full":
|
442
|
-
"major":
|
451
|
+
"full": "6.8.7-hardened1-2-hardened",
|
452
|
+
"major": "6",
|
453
|
+
"minor": "8"
|
443
454
|
},
|
444
455
|
"selinux": {
|
445
456
|
"enabled": false
|
data/lib/facterdb/version.rb
CHANGED
data/lib/facterdb.rb
CHANGED
@@ -137,13 +137,17 @@ module FacterDB
|
|
137
137
|
|
138
138
|
# @return [Array[Hash[Symbol, Any]]] array of hashes of facts
|
139
139
|
# @param filter [Object] The filter to convert to jgrep string
|
140
|
-
|
140
|
+
# @param symbolize_keys [Boolean]
|
141
|
+
# Whether to symbolize the keys. Note this is only on the top level and not
|
142
|
+
# on nested values.
|
143
|
+
def self.get_facts(filter = nil, cache = true, symbolize_keys: true)
|
141
144
|
if cache && filter && filter == Thread.current[:facterdb_last_filter_seen]
|
142
145
|
return Thread.current[:facterdb_last_facts_seen]
|
143
146
|
end
|
144
147
|
|
145
148
|
filter_str = generate_filter_str(filter)
|
146
|
-
result = JGrep.jgrep(database, filter_str)
|
149
|
+
result = JGrep.jgrep(database, filter_str)
|
150
|
+
result = result.map { |hash| hash.transform_keys(&:to_sym) } if symbolize_keys
|
147
151
|
if cache
|
148
152
|
Thread.current[:facterdb_last_filter_seen] = filter
|
149
153
|
Thread.current[:facterdb_last_facts_seen] = result
|
data/spec/facter_db_spec.rb
CHANGED
@@ -319,14 +319,35 @@ describe FacterDB do
|
|
319
319
|
end
|
320
320
|
|
321
321
|
describe '.get_facts' do
|
322
|
-
subject(:result) { FacterDB.get_facts(filter) }
|
322
|
+
subject(:result) { FacterDB.get_facts(filter, symbolize_keys: symbolize_keys) }
|
323
323
|
|
324
324
|
let(:filter) { nil }
|
325
|
+
let(:symbolize_keys) { nil }
|
325
326
|
|
326
327
|
context 'without parameters' do
|
327
328
|
include_examples 'returns a result'
|
328
329
|
end
|
329
330
|
|
331
|
+
context 'with stringified output' do
|
332
|
+
let(:symbolize_keys) { false }
|
333
|
+
|
334
|
+
it 'returns strings as keys in factsets' do
|
335
|
+
result.each do |factset|
|
336
|
+
expect(factset.keys).to all(be_an_instance_of(String))
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
context 'with symbolized output' do
|
342
|
+
let(:symbolize_keys) { true }
|
343
|
+
|
344
|
+
it 'returns strings as keys in factsets' do
|
345
|
+
result.each do |factset|
|
346
|
+
expect(factset.keys).to all(be_an_instance_of(Symbol))
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
330
351
|
context 'with an Array filter' do
|
331
352
|
let(:filter) { [osfamily: 'Debian'] }
|
332
353
|
|
data/spec/facts_spec.rb
CHANGED
@@ -117,6 +117,14 @@ describe 'Default Facts' do
|
|
117
117
|
expect(content['systemd_version']).to be_nil
|
118
118
|
expect(content['systemd_internal_services']).to be_nil
|
119
119
|
end
|
120
|
+
|
121
|
+
# those are used in newer rspec-puppet-facts versions
|
122
|
+
# by ensuring those facts exists, we can drop a huge amount of logic in rspec-puppet-facts
|
123
|
+
it 'contains the mandatory OS facts' do
|
124
|
+
expect(content['os']['release']['major']).to not_be_nil.and not_be_empty
|
125
|
+
expect(content['os']['name']).to not_be_nil.and not_be_empty
|
126
|
+
expect(content['os']['hardware']).to not_be_nil.and not_be_empty
|
127
|
+
end
|
120
128
|
end
|
121
129
|
end
|
122
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facterdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|