facterdb 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +3 -2
- data/CHANGELOG.md +14 -0
- data/README.md +95 -94
- data/facts/1.7/centos-9-x86_64.facts +82 -0
- data/facts/2.0/centos-9-x86_64.facts +82 -0
- data/facts/2.1/centos-9-x86_64.facts +112 -0
- data/facts/2.2/centos-9-x86_64.facts +137 -0
- data/facts/2.3/centos-9-x86_64.facts +138 -0
- data/facts/2.4/centos-9-x86_64.facts +139 -0
- data/facts/3.14/darwin-20-x86_64.facts +516 -0
- data/facts/4.2/centos-9-x86_64.facts +291 -0
- data/facts/4.2/darwin-20-x86_64.facts +524 -0
- data/lib/facterdb.rb +17 -2
- data/lib/facterdb/version.rb +1 -1
- metadata +11 -2
data/lib/facterdb.rb
CHANGED
@@ -11,6 +11,13 @@ module FacterDB
|
|
11
11
|
@database ||= "[#{facterdb_fact_files.map { |f| read_json_file(f) }.join(',')}]\n"
|
12
12
|
end
|
13
13
|
|
14
|
+
# @note Call this method at the end of test suite, for example via after(:suite), to reclaim back the memory required to hold json data and filter cache
|
15
|
+
def self.cleanup
|
16
|
+
@database = nil
|
17
|
+
Thread.current[:facterdb_last_filter_seen] = nil
|
18
|
+
Thread.current[:facterdb_last_facts_seen] = nil
|
19
|
+
end
|
20
|
+
|
14
21
|
# @return [Boolean] - returns true if we should use the default facterdb database, false otherwise
|
15
22
|
# @note If the user passes anything to the FACTERDB_SKIP_DEFAULTDB environment variable we assume
|
16
23
|
# they want to skip the default db
|
@@ -123,8 +130,16 @@ module FacterDB
|
|
123
130
|
|
124
131
|
# @return [Array] - array of hashes of facts
|
125
132
|
# @param filter [Object] - The filter to convert to jgrep string
|
126
|
-
def self.get_facts(filter=nil)
|
133
|
+
def self.get_facts(filter=nil, cache=true)
|
134
|
+
if cache && filter && filter == Thread.current[:facterdb_last_filter_seen]
|
135
|
+
return Thread.current[:facterdb_last_facts_seen]
|
136
|
+
end
|
127
137
|
filter_str = generate_filter_str(filter)
|
128
|
-
JGrep.jgrep(database, filter_str).map { |hash| Hash[hash.map{ |k, v| [k.to_sym, v] }] }
|
138
|
+
result = JGrep.jgrep(database, filter_str).map { |hash| Hash[hash.map{ |k, v| [k.to_sym, v] }] }
|
139
|
+
if cache
|
140
|
+
Thread.current[:facterdb_last_filter_seen] = filter
|
141
|
+
Thread.current[:facterdb_last_facts_seen] = result
|
142
|
+
end
|
143
|
+
result
|
129
144
|
end
|
130
145
|
end
|
data/lib/facterdb/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.8.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: 2021-
|
11
|
+
date: 2021-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- facts/1.7/centos-7-i386.facts
|
220
220
|
- facts/1.7/centos-7-x86_64.facts
|
221
221
|
- facts/1.7/centos-8-x86_64.facts
|
222
|
+
- facts/1.7/centos-9-x86_64.facts
|
222
223
|
- facts/1.7/debian-10-x86_64.facts
|
223
224
|
- facts/1.7/debian-6-i386.facts
|
224
225
|
- facts/1.7/debian-6-x86_64.facts
|
@@ -313,6 +314,7 @@ files:
|
|
313
314
|
- facts/2.0/centos-7-i386.facts
|
314
315
|
- facts/2.0/centos-7-x86_64.facts
|
315
316
|
- facts/2.0/centos-8-x86_64.facts
|
317
|
+
- facts/2.0/centos-9-x86_64.facts
|
316
318
|
- facts/2.0/darwin-14-i386.facts
|
317
319
|
- facts/2.0/darwin-14-x86_64.facts
|
318
320
|
- facts/2.0/darwin-15-x86_64.facts
|
@@ -423,6 +425,7 @@ files:
|
|
423
425
|
- facts/2.1/centos-7-i386.facts
|
424
426
|
- facts/2.1/centos-7-x86_64.facts
|
425
427
|
- facts/2.1/centos-8-x86_64.facts
|
428
|
+
- facts/2.1/centos-9-x86_64.facts
|
426
429
|
- facts/2.1/darwin-14-i386.facts
|
427
430
|
- facts/2.1/darwin-14-x86_64.facts
|
428
431
|
- facts/2.1/darwin-15-x86_64.facts
|
@@ -543,6 +546,7 @@ files:
|
|
543
546
|
- facts/2.2/centos-7-i386.facts
|
544
547
|
- facts/2.2/centos-7-x86_64.facts
|
545
548
|
- facts/2.2/centos-8-x86_64.facts
|
549
|
+
- facts/2.2/centos-9-x86_64.facts
|
546
550
|
- facts/2.2/darwin-14-i386.facts
|
547
551
|
- facts/2.2/darwin-14-x86_64.facts
|
548
552
|
- facts/2.2/darwin-15-x86_64.facts
|
@@ -663,6 +667,7 @@ files:
|
|
663
667
|
- facts/2.3/centos-7-i386.facts
|
664
668
|
- facts/2.3/centos-7-x86_64.facts
|
665
669
|
- facts/2.3/centos-8-x86_64.facts
|
670
|
+
- facts/2.3/centos-9-x86_64.facts
|
666
671
|
- facts/2.3/darwin-14-i386.facts
|
667
672
|
- facts/2.3/darwin-14-x86_64.facts
|
668
673
|
- facts/2.3/darwin-15-x86_64.facts
|
@@ -784,6 +789,7 @@ files:
|
|
784
789
|
- facts/2.4/centos-7-i386.facts
|
785
790
|
- facts/2.4/centos-7-x86_64.facts
|
786
791
|
- facts/2.4/centos-8-x86_64.facts
|
792
|
+
- facts/2.4/centos-9-x86_64.facts
|
787
793
|
- facts/2.4/darwin-14-i386.facts
|
788
794
|
- facts/2.4/darwin-14-x86_64.facts
|
789
795
|
- facts/2.4/darwin-15-x86_64.facts
|
@@ -1284,6 +1290,7 @@ files:
|
|
1284
1290
|
- facts/3.14/darwin-17-x86_64.facts
|
1285
1291
|
- facts/3.14/darwin-18-x86_64.facts
|
1286
1292
|
- facts/3.14/darwin-19-x86_64.facts
|
1293
|
+
- facts/3.14/darwin-20-x86_64.facts
|
1287
1294
|
- facts/3.14/debian-10-x86_64.facts
|
1288
1295
|
- facts/3.14/debian-8-x86_64.facts
|
1289
1296
|
- facts/3.14/debian-9-x86_64.facts
|
@@ -1697,6 +1704,8 @@ files:
|
|
1697
1704
|
- facts/4.0/centos-7-x86_64.facts
|
1698
1705
|
- facts/4.0/debian-10-x86_64.facts
|
1699
1706
|
- facts/4.0/solaris-11-sun4v.facts
|
1707
|
+
- facts/4.2/centos-9-x86_64.facts
|
1708
|
+
- facts/4.2/darwin-20-x86_64.facts
|
1700
1709
|
- facts/Gemfile
|
1701
1710
|
- facts/Vagrantfile
|
1702
1711
|
- facts/Windows_README.md
|