facter 4.0.37 → 4.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/facter.rb +68 -11
- data/lib/facter/facts/rhel/os/release.rb +2 -2
- data/lib/facter/framework/logging/logger.rb +2 -6
- 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: 4cded925592073cd18baac69fc11f1154cbeda4370359e9d3e6655f97194d467
|
4
|
+
data.tar.gz: 16ea8f7a28b6ae86b0098a8c9412329dfa2665e1ca1a66ca3cc2d7e734452fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be78011c78dab1cdc01e44af6a2e2e053f3600c43a4c758e1edbf2b6a067052de36a8166749148fc2740694394af682c38cd7f72d516f75a323af9c69a278667
|
7
|
+
data.tar.gz: 3b614e324b33c54c571e5857ea184dcf89d0e7e1fdc9030ee57478bdc3eaa6c0511d73f8f18441e33d31258ea5be7f227b3412770a90f82ed8fe789f9f3690f8
|
data/lib/facter.rb
CHANGED
@@ -13,6 +13,8 @@ module Facter
|
|
13
13
|
Options.init
|
14
14
|
Log.output(STDOUT)
|
15
15
|
@already_searched = {}
|
16
|
+
@debug_once = []
|
17
|
+
@warn_once = []
|
16
18
|
|
17
19
|
class << self
|
18
20
|
def clear_messages
|
@@ -54,6 +56,8 @@ module Facter
|
|
54
56
|
# @api public
|
55
57
|
def clear
|
56
58
|
@already_searched = {}
|
59
|
+
@debug_once = []
|
60
|
+
@warn_once = []
|
57
61
|
LegacyFacter.clear
|
58
62
|
Options[:custom_dir] = []
|
59
63
|
LegacyFacter.collection.invalidate_custom_facts
|
@@ -68,16 +72,33 @@ module Facter
|
|
68
72
|
fact_collection.dig(*splitted_user_query)
|
69
73
|
end
|
70
74
|
|
71
|
-
#
|
72
|
-
# @param
|
75
|
+
# Logs debug message when debug option is set to true
|
76
|
+
# @param message [Object] Message object to be logged
|
73
77
|
#
|
74
78
|
# @return [nil]
|
75
79
|
#
|
76
80
|
# @api public
|
77
|
-
def debug(
|
81
|
+
def debug(message)
|
78
82
|
return unless debugging?
|
79
83
|
|
80
|
-
logger.debug(
|
84
|
+
logger.debug(message.to_s)
|
85
|
+
nil
|
86
|
+
end
|
87
|
+
|
88
|
+
# Logs the same debug message only once when debug option is set to true
|
89
|
+
# @param message [Object] Message object to be logged
|
90
|
+
#
|
91
|
+
# @return [nil]
|
92
|
+
#
|
93
|
+
# @api public
|
94
|
+
def debugonce(message)
|
95
|
+
return unless debugging?
|
96
|
+
|
97
|
+
message_string = message.to_s
|
98
|
+
return if @debug_once.include? message_string
|
99
|
+
|
100
|
+
@debug_once << message_string
|
101
|
+
logger.debug(message_string)
|
81
102
|
nil
|
82
103
|
end
|
83
104
|
|
@@ -85,7 +106,7 @@ module Facter
|
|
85
106
|
Facter::Log.on_message(&block)
|
86
107
|
end
|
87
108
|
|
88
|
-
# Check whether
|
109
|
+
# Check whether debugging is enabled
|
89
110
|
#
|
90
111
|
# @return [bool]
|
91
112
|
#
|
@@ -108,7 +129,7 @@ module Facter
|
|
108
129
|
# call {Facter::Util::Fact#value `value`} on it to retrieve the actual
|
109
130
|
# value.
|
110
131
|
#
|
111
|
-
# @param
|
132
|
+
# @param user_query [String] the name of the fact
|
112
133
|
#
|
113
134
|
# @return [Facter::Util::Fact, nil] The fact object, or nil if no fact
|
114
135
|
# is found.
|
@@ -199,7 +220,7 @@ module Facter
|
|
199
220
|
end
|
200
221
|
|
201
222
|
# Enable or disable trace
|
202
|
-
# @param
|
223
|
+
# @param bool [bool] Set trace on debug state
|
203
224
|
#
|
204
225
|
# @return [type] [description]
|
205
226
|
#
|
@@ -210,7 +231,7 @@ module Facter
|
|
210
231
|
|
211
232
|
# Gets the value for a fact. Returns `nil` if no such fact exists.
|
212
233
|
#
|
213
|
-
# @param
|
234
|
+
# @param user_query [String] the fact name
|
214
235
|
# @return [String] the value of the fact, or nil if no fact is found
|
215
236
|
#
|
216
237
|
# @api public
|
@@ -262,6 +283,43 @@ module Facter
|
|
262
283
|
logger.error(arr.flatten.join("\n"))
|
263
284
|
end
|
264
285
|
|
286
|
+
# Returns a list with the names of all solved facts
|
287
|
+
#
|
288
|
+
# @return [Array] the list with all the fact names
|
289
|
+
#
|
290
|
+
# @api public
|
291
|
+
def list
|
292
|
+
to_hash.keys.sort
|
293
|
+
end
|
294
|
+
|
295
|
+
# Logs the message parameter as a warning.
|
296
|
+
#
|
297
|
+
# @param message [Object] the warning object to be displayed
|
298
|
+
#
|
299
|
+
# @return [nil]
|
300
|
+
#
|
301
|
+
# @api public
|
302
|
+
def warn(message)
|
303
|
+
logger.warn(message.to_s)
|
304
|
+
nil
|
305
|
+
end
|
306
|
+
|
307
|
+
# Logs only once the same warning message.
|
308
|
+
#
|
309
|
+
# @param message [Object] the warning message object
|
310
|
+
#
|
311
|
+
# @return [nil]
|
312
|
+
#
|
313
|
+
# @api public
|
314
|
+
def warnonce(message)
|
315
|
+
message_string = message.to_s
|
316
|
+
return if @warn_once.include? message_string
|
317
|
+
|
318
|
+
@warn_once << message_string
|
319
|
+
logger.warn(message_string)
|
320
|
+
nil
|
321
|
+
end
|
322
|
+
|
265
323
|
private
|
266
324
|
|
267
325
|
def logger
|
@@ -303,10 +361,9 @@ module Facter
|
|
303
361
|
# Returns exit status when user query contains facts that do
|
304
362
|
# not exist
|
305
363
|
#
|
306
|
-
# @param
|
307
|
-
# @param dirs [Array] List of resolved facts
|
364
|
+
# @param resolved_facts [Array] List of resolved facts
|
308
365
|
#
|
309
|
-
# @return [
|
366
|
+
# @return [1/nil] Will return status 1 if user query contains
|
310
367
|
# facts that are not found or resolved, otherwise it will return nil
|
311
368
|
#
|
312
369
|
# @api private
|
@@ -18,8 +18,8 @@ module Facts
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def determine_release_version
|
21
|
-
version = Facter::Resolvers::
|
22
|
-
version ||= Facter::Resolvers::
|
21
|
+
version = Facter::Resolvers::RedHatRelease.resolve(:version)
|
22
|
+
version ||= Facter::Resolvers::OsRelease.resolve(:version_id)
|
23
23
|
|
24
24
|
return unless version
|
25
25
|
|
@@ -60,9 +60,7 @@ module Facter
|
|
60
60
|
def debug(msg)
|
61
61
|
return unless debugging_active?
|
62
62
|
|
63
|
-
if
|
64
|
-
empty_message_error(msg)
|
65
|
-
elsif @@message_callback
|
63
|
+
if @@message_callback
|
66
64
|
@@message_callback.call(:debug, msg)
|
67
65
|
else
|
68
66
|
msg = colorize(msg, CYAN) if Options[:color]
|
@@ -82,9 +80,7 @@ module Facter
|
|
82
80
|
end
|
83
81
|
|
84
82
|
def warn(msg)
|
85
|
-
if
|
86
|
-
empty_message_error(msg)
|
87
|
-
elsif @@message_callback
|
83
|
+
if @@message_callback
|
88
84
|
@@message_callback.call(:warn, msg)
|
89
85
|
else
|
90
86
|
msg = colorize(msg, YELLOW) if Options[:color]
|
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.0.
|
4
|
+
version: 4.0.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|