puppet 7.10.0-universal-darwin → 7.13.1-universal-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Gemfile.lock +20 -15
- data/ext/project_data.yaml +1 -1
- data/lib/puppet/application/agent.rb +4 -0
- data/lib/puppet/application/apply.rb +20 -2
- data/lib/puppet/application/lookup.rb +72 -24
- data/lib/puppet/application/resource.rb +15 -13
- data/lib/puppet/concurrent/thread_local_singleton.rb +6 -3
- data/lib/puppet/configurer.rb +98 -29
- data/lib/puppet/confine/variable.rb +1 -1
- data/lib/puppet/defaults.rb +17 -3
- data/lib/puppet/facter_impl.rb +96 -0
- data/lib/puppet/file_serving/metadata.rb +3 -0
- data/lib/puppet/file_serving/mount/file.rb +4 -4
- data/lib/puppet/file_system/file_impl.rb +10 -8
- data/lib/puppet/file_system/jruby.rb +1 -1
- data/lib/puppet/file_system/path_pattern.rb +10 -15
- data/lib/puppet/file_system/uniquefile.rb +1 -1
- data/lib/puppet/file_system/windows.rb +4 -4
- data/lib/puppet/file_system.rb +3 -2
- data/lib/puppet/forge.rb +1 -1
- data/lib/puppet/functions/versioncmp.rb +6 -2
- data/lib/puppet/graph/simple_graph.rb +2 -1
- data/lib/puppet/http/client.rb +1 -1
- data/lib/puppet/http/redirector.rb +5 -0
- data/lib/puppet/indirector/catalog/compiler.rb +3 -3
- data/lib/puppet/indirector/facts/facter.rb +6 -6
- data/lib/puppet/indirector/indirection.rb +1 -1
- data/lib/puppet/module_tool/applications/uninstaller.rb +1 -1
- data/lib/puppet/module_tool/applications/upgrader.rb +1 -1
- data/lib/puppet/pal/pal_impl.rb +1 -1
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/parser/scope.rb +8 -7
- data/lib/puppet/parser/templatewrapper.rb +1 -0
- data/lib/puppet/pops/evaluator/closure.rb +7 -5
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -0
- data/lib/puppet/pops/lookup/lookup_adapter.rb +3 -2
- data/lib/puppet/pops/model/ast.rb +1 -0
- data/lib/puppet/pops/model/factory.rb +14 -13
- data/lib/puppet/pops/parser/code_merger.rb +4 -4
- data/lib/puppet/pops/parser/egrammar.ra +4 -2
- data/lib/puppet/pops/parser/eparser.rb +909 -894
- data/lib/puppet/pops/parser/lexer2.rb +69 -68
- data/lib/puppet/pops/parser/slurp_support.rb +1 -0
- data/lib/puppet/pops/serialization/to_data_converter.rb +6 -18
- data/lib/puppet/pops/serialization/to_stringified_converter.rb +1 -1
- data/lib/puppet/pops/types/type_formatter.rb +7 -6
- data/lib/puppet/pops/types/types.rb +1 -1
- data/lib/puppet/pops/validation/checker4_0.rb +7 -2
- data/lib/puppet/provider/aix_object.rb +1 -1
- data/lib/puppet/provider/group/groupadd.rb +5 -2
- data/lib/puppet/provider/package/pkg.rb +11 -1
- data/lib/puppet/provider/package/puppet_gem.rb +1 -1
- data/lib/puppet/provider/package/puppetserver_gem.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/init.rb +10 -9
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/service/redhat.rb +1 -1
- data/lib/puppet/provider/service/smf.rb +3 -3
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/service/upstart.rb +5 -5
- data/lib/puppet/provider/user/aix.rb +44 -1
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +30 -7
- data/lib/puppet/provider.rb +1 -1
- data/lib/puppet/reference/providers.rb +2 -2
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/resource/type_collection.rb +2 -1
- data/lib/puppet/resource.rb +38 -5
- data/lib/puppet/runtime.rb +11 -1
- data/lib/puppet/settings/file_setting.rb +3 -8
- data/lib/puppet/settings.rb +2 -2
- data/lib/puppet/ssl/verifier.rb +3 -1
- data/lib/puppet/test/test_helper.rb +4 -1
- data/lib/puppet/transaction/persistence.rb +22 -12
- data/lib/puppet/type/exec.rb +9 -1
- data/lib/puppet/type/file/data_sync.rb +1 -1
- data/lib/puppet/type/file/group.rb +8 -1
- data/lib/puppet/type/file/owner.rb +8 -1
- data/lib/puppet/type/group.rb +0 -1
- data/lib/puppet/type/resources.rb +1 -1
- data/lib/puppet/type/service.rb +8 -3
- data/lib/puppet/type/user.rb +40 -39
- data/lib/puppet/util/autoload.rb +1 -1
- data/lib/puppet/util/command_line.rb +1 -1
- data/lib/puppet/util/filetype.rb +2 -2
- data/lib/puppet/util/json.rb +20 -0
- data/lib/puppet/util/log.rb +8 -4
- data/lib/puppet/util/logging.rb +1 -25
- data/lib/puppet/util/monkey_patches.rb +26 -2
- data/lib/puppet/util/package.rb +25 -16
- data/lib/puppet/util/pidlock.rb +1 -1
- data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +1 -1
- data/lib/puppet/util/suidmanager.rb +1 -2
- data/lib/puppet/util/tagging.rb +1 -0
- data/lib/puppet/util/windows/service.rb +0 -5
- data/lib/puppet/util/windows/user.rb +0 -1
- data/lib/puppet/util/windows.rb +3 -0
- data/lib/puppet/util/yaml.rb +11 -0
- data/lib/puppet/util.rb +4 -3
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet.rb +3 -6
- data/locales/puppet.pot +265 -239
- data/man/man5/puppet.conf.5 +18 -2
- data/man/man8/puppet-agent.8 +4 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-lookup.8 +9 -6
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +2 -1
- data/spec/fixtures/unit/forge/bacula.json +1 -1
- data/spec/integration/application/agent_spec.rb +44 -0
- data/spec/integration/application/lookup_spec.rb +29 -6
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/indirector/facts/facter_spec.rb +3 -3
- data/spec/integration/parser/pcore_resource_spec.rb +20 -0
- data/spec/integration/transaction/report_spec.rb +1 -1
- data/spec/integration/type/file_spec.rb +2 -2
- data/spec/integration/type/package_spec.rb +6 -6
- data/spec/integration/util/rdoc/parser_spec.rb +1 -1
- data/spec/integration/util/windows/process_spec.rb +1 -9
- data/spec/shared_contexts/l10n.rb +5 -0
- data/spec/unit/application/apply_spec.rb +76 -56
- data/spec/unit/application/lookup_spec.rb +131 -10
- data/spec/unit/application/resource_spec.rb +29 -0
- data/spec/unit/concurrent/thread_local_singleton_spec.rb +39 -0
- data/spec/unit/configurer_spec.rb +113 -28
- data/spec/unit/facter_impl_spec.rb +31 -0
- data/spec/unit/file_bucket/dipper_spec.rb +2 -2
- data/spec/unit/file_system/uniquefile_spec.rb +7 -1
- data/spec/unit/file_system_spec.rb +41 -4
- data/spec/unit/forge/module_release_spec.rb +3 -3
- data/spec/unit/functions/lookup_spec.rb +64 -0
- data/spec/unit/functions/versioncmp_spec.rb +40 -4
- data/spec/unit/http/client_spec.rb +58 -1
- data/spec/unit/indirector/indirection_spec.rb +10 -3
- data/spec/unit/network/formats_spec.rb +6 -0
- data/spec/unit/pops/parser/parse_containers_spec.rb +2 -2
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +0 -58
- data/spec/unit/pops/serialization/to_stringified_spec.rb +5 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +6 -0
- data/spec/unit/pops/validator/validator_spec.rb +5 -0
- data/spec/unit/provider/package/gem_spec.rb +1 -1
- data/spec/unit/provider/package/pip2_spec.rb +1 -1
- data/spec/unit/provider/package/pip3_spec.rb +1 -1
- data/spec/unit/provider/package/pip_spec.rb +1 -1
- data/spec/unit/provider/package/pkg_spec.rb +15 -0
- data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
- data/spec/unit/provider/package/puppetserver_gem_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_spec.rb +6 -5
- data/spec/unit/provider/service/init_spec.rb +15 -9
- data/spec/unit/provider/service/openwrt_spec.rb +21 -29
- data/spec/unit/provider/service/redhat_spec.rb +3 -2
- data/spec/unit/provider/user/aix_spec.rb +100 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +40 -0
- data/spec/unit/provider_spec.rb +4 -4
- data/spec/unit/puppet_spec.rb +12 -4
- data/spec/unit/resource/catalog_spec.rb +14 -1
- data/spec/unit/resource_spec.rb +58 -2
- data/spec/unit/settings/file_setting_spec.rb +10 -7
- data/spec/unit/transaction/persistence_spec.rb +51 -0
- data/spec/unit/type/file/group_spec.rb +7 -0
- data/spec/unit/type/file/owner_spec.rb +7 -0
- data/spec/unit/type/service_spec.rb +27 -0
- data/spec/unit/type/user_spec.rb +0 -45
- data/spec/unit/type_spec.rb +2 -2
- data/spec/unit/util/autoload_spec.rb +25 -8
- data/spec/unit/util/json_spec.rb +126 -0
- data/spec/unit/util/logging_spec.rb +2 -0
- data/spec/unit/util/yaml_spec.rb +37 -13
- data/tasks/parallel.rake +3 -3
- metadata +17 -4
data/lib/puppet/util/json.rb
CHANGED
@@ -26,6 +26,23 @@ module Puppet::Util
|
|
26
26
|
require 'json'
|
27
27
|
end
|
28
28
|
|
29
|
+
# Load the content from a file as JSON if
|
30
|
+
# contents are in valid format. This method does not
|
31
|
+
# raise error but returns `nil` when invalid file is
|
32
|
+
# given.
|
33
|
+
def self.load_file_if_valid(filename, options = {})
|
34
|
+
load_file(filename, options)
|
35
|
+
rescue Puppet::Util::Json::ParseError, ArgumentError, Errno::ENOENT => detail
|
36
|
+
Puppet.debug("Could not retrieve JSON content from '#{filename}': #{detail.message}")
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
# Load the content from a file as JSON.
|
41
|
+
def self.load_file(filename, options = {})
|
42
|
+
json = Puppet::FileSystem.read(filename, :encoding => 'utf-8')
|
43
|
+
load(json, options)
|
44
|
+
end
|
45
|
+
|
29
46
|
# These methods do similar processing to the fallback implemented by MultiJson
|
30
47
|
# when using the built-in JSON backend, to ensure consistent behavior
|
31
48
|
# whether or not MultiJson can be loaded.
|
@@ -60,6 +77,9 @@ module Puppet::Util
|
|
60
77
|
def self.dump(object, options = {})
|
61
78
|
if defined? MultiJson
|
62
79
|
MultiJson.dump(object, options)
|
80
|
+
elsif options.is_a?(JSON::State)
|
81
|
+
# we're being called recursively
|
82
|
+
object.to_json(options)
|
63
83
|
else
|
64
84
|
options.merge!(::JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty)
|
65
85
|
object.to_json(options)
|
data/lib/puppet/util/log.rb
CHANGED
@@ -2,7 +2,6 @@ require_relative '../../puppet/util/tagging'
|
|
2
2
|
require_relative '../../puppet/util/classgen'
|
3
3
|
require_relative '../../puppet/util/psych_support'
|
4
4
|
require_relative '../../puppet/network/format_support'
|
5
|
-
require 'facter'
|
6
5
|
|
7
6
|
# Pass feedback to the user. Log levels are modeled after syslog's, and it is
|
8
7
|
# expected that that will be the most common log destination. Supports
|
@@ -106,12 +105,17 @@ class Puppet::Util::Log
|
|
106
105
|
def Log.level=(level)
|
107
106
|
level = level.intern unless level.is_a?(Symbol)
|
108
107
|
|
109
|
-
|
108
|
+
# loglevel is a 0-based index
|
109
|
+
loglevel = @levels.index(level)
|
110
|
+
raise Puppet::DevError, _("Invalid loglevel %{level}") % { level: level } unless loglevel
|
110
111
|
|
111
|
-
@loglevel
|
112
|
+
return if @loglevel == loglevel
|
113
|
+
|
114
|
+
# loglevel changed
|
115
|
+
@loglevel = loglevel
|
112
116
|
|
113
117
|
# Enable or disable Facter debugging
|
114
|
-
|
118
|
+
Puppet.runtime[:facter].debugging(level == :debug)
|
115
119
|
end
|
116
120
|
|
117
121
|
def Log.levels
|
data/lib/puppet/util/logging.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
require_relative '../../puppet/util/log'
|
3
3
|
require_relative '../../puppet/error'
|
4
4
|
|
5
|
-
require 'facter'
|
6
|
-
|
7
5
|
module Puppet::Util
|
8
6
|
module Logging
|
9
7
|
|
@@ -254,29 +252,7 @@ module Logging
|
|
254
252
|
# Sets up Facter logging.
|
255
253
|
# This method causes Facter output to be forwarded to Puppet.
|
256
254
|
def self.setup_facter_logging!
|
257
|
-
|
258
|
-
return false unless Facter.respond_to? :on_message
|
259
|
-
|
260
|
-
# The current Facter log levels are: :trace, :debug, :info, :warn, :error, and :fatal.
|
261
|
-
# Convert to the corresponding levels in Puppet
|
262
|
-
Facter.on_message do |level, message|
|
263
|
-
case level
|
264
|
-
when :trace, :debug
|
265
|
-
level = :debug
|
266
|
-
when :info
|
267
|
-
# Same as Puppet
|
268
|
-
when :warn
|
269
|
-
level = :warning
|
270
|
-
when :error
|
271
|
-
level = :err
|
272
|
-
when :fatal
|
273
|
-
level = :crit
|
274
|
-
else
|
275
|
-
next
|
276
|
-
end
|
277
|
-
Puppet::Util::Log.create({:level => level, :source => 'Facter', :message => message})
|
278
|
-
nil
|
279
|
-
end
|
255
|
+
Puppet.runtime[:facter]
|
280
256
|
true
|
281
257
|
end
|
282
258
|
|
@@ -29,6 +29,28 @@ class Object
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
if RUBY_VERSION.to_f < 3.0
|
33
|
+
# absolute/relative were optimized to avoid chop_basename in ruby 3
|
34
|
+
# see https://github.com/ruby/ruby/commit/39312cf4d6c2ab3f07d688ad1a467c8f84b58db0
|
35
|
+
require 'pathname'
|
36
|
+
class Pathname
|
37
|
+
if File.dirname('A:') == 'A:.' # DOSish drive letter
|
38
|
+
ABSOLUTE_PATH = /\A(?:[A-Za-z]:|#{SEPARATOR_PAT})/o
|
39
|
+
else
|
40
|
+
ABSOLUTE_PATH = /\A#{SEPARATOR_PAT}/o
|
41
|
+
end
|
42
|
+
private_constant :ABSOLUTE_PATH
|
43
|
+
|
44
|
+
def absolute?
|
45
|
+
ABSOLUTE_PATH.match? @path
|
46
|
+
end
|
47
|
+
|
48
|
+
def relative?
|
49
|
+
!absolute?
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
32
54
|
# (#19151) Reject all SSLv2 ciphers and handshakes
|
33
55
|
require_relative '../../puppet/ssl/openssl_loader'
|
34
56
|
unless Puppet::Util::Platform.jruby_fips?
|
@@ -83,8 +105,10 @@ if Puppet::Util::Platform.windows?
|
|
83
105
|
end
|
84
106
|
|
85
107
|
unless Puppet::Util::Platform.jruby_fips?
|
86
|
-
unless OpenSSL::X509
|
87
|
-
OpenSSL::X509
|
108
|
+
unless defined?(OpenSSL::X509::V_ERR_HOSTNAME_MISMATCH)
|
109
|
+
module OpenSSL::X509
|
110
|
+
OpenSSL::X509::V_ERR_HOSTNAME_MISMATCH = 0x3E
|
111
|
+
end
|
88
112
|
end
|
89
113
|
|
90
114
|
# jruby-openssl doesn't support this
|
data/lib/puppet/util/package.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Puppet::Util::Package
|
2
|
-
def versioncmp(version_a, version_b)
|
3
|
+
def versioncmp(version_a, version_b, ignore_trailing_zeroes = false)
|
3
4
|
vre = /[-.]|\d+|[^-.\d]+/
|
5
|
+
|
6
|
+
if ignore_trailing_zeroes
|
7
|
+
version_a = normalize(version_a)
|
8
|
+
version_b = normalize(version_b)
|
9
|
+
end
|
10
|
+
|
4
11
|
ax = version_a.scan(vre)
|
5
12
|
bx = version_b.scan(vre)
|
6
13
|
|
@@ -8,24 +15,26 @@ module Puppet::Util::Package
|
|
8
15
|
a = ax.shift
|
9
16
|
b = bx.shift
|
10
17
|
|
11
|
-
if
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
elsif (a =~ /^\d+$/ && b =~ /^\d+$/) then
|
19
|
-
if( a =~ /^0/ or b =~ /^0/ ) then
|
20
|
-
return a.to_s.upcase <=> b.to_s.upcase
|
21
|
-
end
|
18
|
+
next if a == b
|
19
|
+
return -1 if a == '-'
|
20
|
+
return 1 if b == '-'
|
21
|
+
return -1 if a == '.'
|
22
|
+
return 1 if b == '.'
|
23
|
+
if a =~ /^\d+$/ && b =~ /^\d+$/
|
24
|
+
return a.to_s.upcase <=> b.to_s.upcase if a =~ /^0/ || b =~ /^0/
|
22
25
|
return a.to_i <=> b.to_i
|
23
|
-
else
|
24
|
-
return a.upcase <=> b.upcase
|
25
26
|
end
|
27
|
+
return a.upcase <=> b.upcase
|
26
28
|
end
|
27
|
-
version_a <=> version_b
|
29
|
+
version_a <=> version_b
|
28
30
|
end
|
29
|
-
|
30
31
|
module_function :versioncmp
|
32
|
+
|
33
|
+
def self.normalize(version)
|
34
|
+
version = version.split('-')
|
35
|
+
version.first.sub!(/([\.0]+)$/, '')
|
36
|
+
|
37
|
+
version.join('-')
|
38
|
+
end
|
39
|
+
private_class_method :normalize
|
31
40
|
end
|
data/lib/puppet/util/pidlock.rb
CHANGED
@@ -154,7 +154,7 @@ module RDoc::PuppetParserCore
|
|
154
154
|
# fetch comments
|
155
155
|
if line =~ /^[ \t]*# ?(.*)$/
|
156
156
|
comments += $1 + "\n"
|
157
|
-
elsif line =~ /^[ \t]*Facter.add\(['"](.*?)['"]\)/
|
157
|
+
elsif line =~ /^[ \t]*(Facter.add|Puppet\.runtime\[:facter\].add)\(['"](.*?)['"]\)/
|
158
158
|
current_fact = RDoc::Fact.new($1,{})
|
159
159
|
look_for_directives_in(container, comments) unless comments.empty?
|
160
160
|
current_fact.comment = comments
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'facter'
|
2
1
|
require_relative '../../puppet/util/warnings'
|
3
2
|
require 'forwardable'
|
4
3
|
require 'etc'
|
@@ -18,7 +17,7 @@ module Puppet::Util::SUIDManager
|
|
18
17
|
|
19
18
|
def osx_maj_ver
|
20
19
|
return @osx_maj_ver unless @osx_maj_ver.nil?
|
21
|
-
@osx_maj_ver =
|
20
|
+
@osx_maj_ver = Puppet.runtime[:facter].value('macosx_productversion_major') || false
|
22
21
|
end
|
23
22
|
module_function :osx_maj_ver
|
24
23
|
|
data/lib/puppet/util/tagging.rb
CHANGED
@@ -18,11 +18,6 @@ module Puppet::Util::Windows
|
|
18
18
|
include Puppet::FFI::Windows::Functions
|
19
19
|
extend Puppet::FFI::Windows::Functions
|
20
20
|
|
21
|
-
# integer value of the floor for timeouts when waiting for service pending states.
|
22
|
-
# puppet will wait the length of dwWaitHint if it is longer than this value, but
|
23
|
-
# no shorter
|
24
|
-
DEFAULT_TIMEOUT = 30
|
25
|
-
|
26
21
|
# Returns true if the service exists, false otherwise.
|
27
22
|
#
|
28
23
|
# @param [String] service_name name of the service
|
data/lib/puppet/util/windows.rb
CHANGED
data/lib/puppet/util/yaml.rb
CHANGED
@@ -42,6 +42,17 @@ module Puppet::Util::Yaml
|
|
42
42
|
safe_load(yaml, allowed_classes, filename)
|
43
43
|
end
|
44
44
|
|
45
|
+
# Safely load the content from a file as YAML if
|
46
|
+
# contents are in valid format. This method does not
|
47
|
+
# raise error but returns `nil` when invalid file is
|
48
|
+
# given.
|
49
|
+
def self.safe_load_file_if_valid(filename, allowed_classes = [])
|
50
|
+
safe_load_file(filename, allowed_classes)
|
51
|
+
rescue YamlLoadError, ArgumentError, Errno::ENOENT => detail
|
52
|
+
Puppet.debug("Could not retrieve YAML content from '#{filename}': #{detail.message}")
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
|
45
56
|
def self.dump(structure, filename)
|
46
57
|
Puppet::FileSystem.replace_file(filename, 0660) do |fh|
|
47
58
|
YAML.dump(structure, fh)
|
data/lib/puppet/util.rb
CHANGED
@@ -772,12 +772,13 @@ module Util
|
|
772
772
|
# Executes a block of code, wrapped around Facter.load_external(false) and
|
773
773
|
# Facter.load_external(true) which will cause Facter to not evaluate external facts.
|
774
774
|
def skip_external_facts
|
775
|
-
return yield unless
|
775
|
+
return yield unless Puppet.runtime[:facter].load_external?
|
776
|
+
|
776
777
|
begin
|
777
|
-
|
778
|
+
Puppet.runtime[:facter].load_external(false)
|
778
779
|
yield
|
779
780
|
ensure
|
780
|
-
|
781
|
+
Puppet.runtime[:facter].load_external(true)
|
781
782
|
end
|
782
783
|
end
|
783
784
|
module_function :skip_external_facts
|
data/lib/puppet/version.rb
CHANGED
data/lib/puppet.rb
CHANGED
@@ -12,7 +12,6 @@ $LOAD_PATH.extend(Puppet::Concurrent::Synchronized)
|
|
12
12
|
# see the bottom of the file for further inclusions
|
13
13
|
# Also see the new Vendor support - towards the end
|
14
14
|
#
|
15
|
-
require 'facter'
|
16
15
|
require_relative 'puppet/error'
|
17
16
|
require_relative 'puppet/util'
|
18
17
|
require_relative 'puppet/util/autoload'
|
@@ -88,9 +87,6 @@ module Puppet
|
|
88
87
|
require_relative 'puppet/util/logging'
|
89
88
|
extend Puppet::Util::Logging
|
90
89
|
|
91
|
-
# Setup facter's logging
|
92
|
-
Puppet::Util::Logging.setup_facter_logging!
|
93
|
-
|
94
90
|
# The feature collection
|
95
91
|
@features = Puppet::Util::Feature.new('puppet/feature')
|
96
92
|
|
@@ -193,11 +189,11 @@ module Puppet
|
|
193
189
|
def self.initialize_facts
|
194
190
|
# Add the puppetversion fact; this is done before generating the hash so it is
|
195
191
|
# accessible to custom facts.
|
196
|
-
|
192
|
+
Puppet.runtime[:facter].add(:puppetversion) do
|
197
193
|
setcode { Puppet.version.to_s }
|
198
194
|
end
|
199
195
|
|
200
|
-
|
196
|
+
Puppet.runtime[:facter].add(:agent_specified_environment) do
|
201
197
|
setcode do
|
202
198
|
Puppet.settings.set_by_cli(:environment) ||
|
203
199
|
Puppet.settings.set_in_section(:environment, :agent) ||
|
@@ -359,3 +355,4 @@ require_relative 'puppet/util/storage'
|
|
359
355
|
require_relative 'puppet/file_bucket/file'
|
360
356
|
require_relative 'puppet/plugins/configuration'
|
361
357
|
require_relative 'puppet/pal/pal_api'
|
358
|
+
require_relative 'puppet/node/facts'
|