facter 4.0.50 → 4.0.51
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db03b26f8336c77d444ced6b4d073a927b529e6272ef0ba65eafc69af0e66060
|
4
|
+
data.tar.gz: a07adb46289f6315764d40a3f21c967de22c187fe9070177959a02c82bd1da6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf1b38ac9c4e67b93e73474afa8f134132f0afd90d9cb5e45a4ced0c2cca3874ca581d1e6dd59ea154eb57e7ffc423a2a0c9aa1d36bdd04501648499dc30c3f
|
7
|
+
data.tar.gz: 0567b4d6940087e0c0d273392b103bd507fe6f15adbcaa826d783db1eda0c512582da10031400a0360b76fa397150101e925b4f814b394bdc478b615a1d1c1d0
|
data/lib/facter.rb
CHANGED
@@ -44,6 +44,27 @@ module Facter
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def puppet_facts
|
48
|
+
require 'puppet'
|
49
|
+
|
50
|
+
# don't allow puppet logger to be injected in Facter
|
51
|
+
Options[:allow_external_loggers] = false
|
52
|
+
|
53
|
+
Puppet.initialize_settings
|
54
|
+
$LOAD_PATH << Puppet[:libdir] unless $LOAD_PATH.include?(Puppet[:libdir])
|
55
|
+
Facter.reset
|
56
|
+
Facter.search_external([Puppet[:pluginfactdest]])
|
57
|
+
if Puppet.respond_to? :initialize_facts
|
58
|
+
Puppet.initialize_facts
|
59
|
+
else
|
60
|
+
Facter.add(:puppetversion) do
|
61
|
+
setcode { Puppet.version.to_s }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
rescue LoadError => e
|
65
|
+
logger.error("Could not load puppet gem, got #{e}")
|
66
|
+
end
|
67
|
+
|
47
68
|
# Alias method for Facter.fact()
|
48
69
|
# @param name [string] fact name
|
49
70
|
#
|
@@ -159,9 +159,7 @@ module Facter
|
|
159
159
|
desc '--puppet, -p', '(NOT SUPPORTED)Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.'
|
160
160
|
map ['--puppet', '-p'] => :puppet
|
161
161
|
def puppet(*args)
|
162
|
-
|
163
|
-
log.warn('`facter --puppet` and `facter -p` are no longer supported, use `puppet facts show` instead')
|
164
|
-
log.warn('the output does not contain puppet facts!')
|
162
|
+
Facter.puppet_facts
|
165
163
|
|
166
164
|
output, status = Facter.to_user_output(@options, *args)
|
167
165
|
puts output
|
@@ -35,6 +35,7 @@ module Facter
|
|
35
35
|
@external_dir = []
|
36
36
|
@custom_dir = []
|
37
37
|
@hocon = false
|
38
|
+
@allow_external_loggers = true
|
38
39
|
|
39
40
|
class << self
|
40
41
|
attr_reader :debug, :verbose, :log_level, :show_legacy,
|
@@ -43,7 +44,7 @@ module Facter
|
|
43
44
|
attr_accessor :config, :user_query, :strict, :json,
|
44
45
|
:cache, :yaml, :puppet, :ttls, :block, :cli, :config_file_custom_dir,
|
45
46
|
:config_file_external_dir, :default_external_dir, :fact_groups,
|
46
|
-
:block_list, :color, :trace, :sequential, :timing, :hocon
|
47
|
+
:block_list, :color, :trace, :sequential, :timing, :hocon, :allow_external_loggers
|
47
48
|
|
48
49
|
attr_writer :external_dir
|
49
50
|
|
@@ -179,7 +180,6 @@ module Facter
|
|
179
180
|
@ttls = []
|
180
181
|
@block = true
|
181
182
|
@cli = nil
|
182
|
-
@custom_facts = true
|
183
183
|
reset_config
|
184
184
|
end
|
185
185
|
|
@@ -198,6 +198,12 @@ module Facter
|
|
198
198
|
@ttls = []
|
199
199
|
@trace = false
|
200
200
|
@timing = false
|
201
|
+
@allow_external_loggers = true
|
202
|
+
reset_facts
|
203
|
+
end
|
204
|
+
|
205
|
+
def reset_facts
|
206
|
+
@custom_facts = true
|
201
207
|
@external_dir = []
|
202
208
|
@custom_dir = []
|
203
209
|
end
|
@@ -60,7 +60,7 @@ module Facter
|
|
60
60
|
def debug(msg)
|
61
61
|
return unless debugging_active?
|
62
62
|
|
63
|
-
if @@message_callback
|
63
|
+
if @@message_callback && Options[:allow_external_loggers]
|
64
64
|
@@message_callback.call(:debug, msg)
|
65
65
|
else
|
66
66
|
msg = colorize(msg, CYAN) if Options[:color]
|
@@ -71,7 +71,7 @@ module Facter
|
|
71
71
|
def info(msg)
|
72
72
|
if msg.nil? || msg.empty?
|
73
73
|
empty_message_error(msg)
|
74
|
-
elsif @@message_callback
|
74
|
+
elsif @@message_callback && Options[:allow_external_loggers]
|
75
75
|
@@message_callback.call(:info, msg)
|
76
76
|
else
|
77
77
|
msg = colorize(msg, GREEN) if Options[:color]
|
@@ -80,7 +80,7 @@ module Facter
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def warn(msg)
|
83
|
-
if @@message_callback
|
83
|
+
if @@message_callback && Options[:allow_external_loggers]
|
84
84
|
@@message_callback.call(:warn, msg)
|
85
85
|
else
|
86
86
|
msg = colorize(msg, YELLOW) if Options[:color]
|
@@ -91,7 +91,7 @@ module Facter
|
|
91
91
|
def error(msg, colorize = false)
|
92
92
|
@@has_errors = true
|
93
93
|
|
94
|
-
if @@message_callback
|
94
|
+
if @@message_callback && Options[:allow_external_loggers]
|
95
95
|
@@message_callback.call(:error, msg)
|
96
96
|
else
|
97
97
|
msg = colorize(msg, RED) if colorize || 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.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|