puppet 7.10.0-universal-darwin → 7.13.1-universal-darwin

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.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/Gemfile.lock +20 -15
  4. data/ext/project_data.yaml +1 -1
  5. data/lib/puppet/application/agent.rb +4 -0
  6. data/lib/puppet/application/apply.rb +20 -2
  7. data/lib/puppet/application/lookup.rb +72 -24
  8. data/lib/puppet/application/resource.rb +15 -13
  9. data/lib/puppet/concurrent/thread_local_singleton.rb +6 -3
  10. data/lib/puppet/configurer.rb +98 -29
  11. data/lib/puppet/confine/variable.rb +1 -1
  12. data/lib/puppet/defaults.rb +17 -3
  13. data/lib/puppet/facter_impl.rb +96 -0
  14. data/lib/puppet/file_serving/metadata.rb +3 -0
  15. data/lib/puppet/file_serving/mount/file.rb +4 -4
  16. data/lib/puppet/file_system/file_impl.rb +10 -8
  17. data/lib/puppet/file_system/jruby.rb +1 -1
  18. data/lib/puppet/file_system/path_pattern.rb +10 -15
  19. data/lib/puppet/file_system/uniquefile.rb +1 -1
  20. data/lib/puppet/file_system/windows.rb +4 -4
  21. data/lib/puppet/file_system.rb +3 -2
  22. data/lib/puppet/forge.rb +1 -1
  23. data/lib/puppet/functions/versioncmp.rb +6 -2
  24. data/lib/puppet/graph/simple_graph.rb +2 -1
  25. data/lib/puppet/http/client.rb +1 -1
  26. data/lib/puppet/http/redirector.rb +5 -0
  27. data/lib/puppet/indirector/catalog/compiler.rb +3 -3
  28. data/lib/puppet/indirector/facts/facter.rb +6 -6
  29. data/lib/puppet/indirector/indirection.rb +1 -1
  30. data/lib/puppet/module_tool/applications/uninstaller.rb +1 -1
  31. data/lib/puppet/module_tool/applications/upgrader.rb +1 -1
  32. data/lib/puppet/pal/pal_impl.rb +1 -1
  33. data/lib/puppet/parser/resource.rb +1 -1
  34. data/lib/puppet/parser/scope.rb +8 -7
  35. data/lib/puppet/parser/templatewrapper.rb +1 -0
  36. data/lib/puppet/pops/evaluator/closure.rb +7 -5
  37. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -0
  38. data/lib/puppet/pops/lookup/lookup_adapter.rb +3 -2
  39. data/lib/puppet/pops/model/ast.rb +1 -0
  40. data/lib/puppet/pops/model/factory.rb +14 -13
  41. data/lib/puppet/pops/parser/code_merger.rb +4 -4
  42. data/lib/puppet/pops/parser/egrammar.ra +4 -2
  43. data/lib/puppet/pops/parser/eparser.rb +909 -894
  44. data/lib/puppet/pops/parser/lexer2.rb +69 -68
  45. data/lib/puppet/pops/parser/slurp_support.rb +1 -0
  46. data/lib/puppet/pops/serialization/to_data_converter.rb +6 -18
  47. data/lib/puppet/pops/serialization/to_stringified_converter.rb +1 -1
  48. data/lib/puppet/pops/types/type_formatter.rb +7 -6
  49. data/lib/puppet/pops/types/types.rb +1 -1
  50. data/lib/puppet/pops/validation/checker4_0.rb +7 -2
  51. data/lib/puppet/provider/aix_object.rb +1 -1
  52. data/lib/puppet/provider/group/groupadd.rb +5 -2
  53. data/lib/puppet/provider/package/pkg.rb +11 -1
  54. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  55. data/lib/puppet/provider/package/puppetserver_gem.rb +1 -1
  56. data/lib/puppet/provider/package/yum.rb +1 -1
  57. data/lib/puppet/provider/service/base.rb +1 -1
  58. data/lib/puppet/provider/service/init.rb +10 -9
  59. data/lib/puppet/provider/service/launchd.rb +1 -1
  60. data/lib/puppet/provider/service/redhat.rb +1 -1
  61. data/lib/puppet/provider/service/smf.rb +3 -3
  62. data/lib/puppet/provider/service/systemd.rb +1 -1
  63. data/lib/puppet/provider/service/upstart.rb +5 -5
  64. data/lib/puppet/provider/user/aix.rb +44 -1
  65. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  66. data/lib/puppet/provider/user/useradd.rb +30 -7
  67. data/lib/puppet/provider.rb +1 -1
  68. data/lib/puppet/reference/providers.rb +2 -2
  69. data/lib/puppet/resource/catalog.rb +1 -1
  70. data/lib/puppet/resource/type_collection.rb +2 -1
  71. data/lib/puppet/resource.rb +38 -5
  72. data/lib/puppet/runtime.rb +11 -1
  73. data/lib/puppet/settings/file_setting.rb +3 -8
  74. data/lib/puppet/settings.rb +2 -2
  75. data/lib/puppet/ssl/verifier.rb +3 -1
  76. data/lib/puppet/test/test_helper.rb +4 -1
  77. data/lib/puppet/transaction/persistence.rb +22 -12
  78. data/lib/puppet/type/exec.rb +9 -1
  79. data/lib/puppet/type/file/data_sync.rb +1 -1
  80. data/lib/puppet/type/file/group.rb +8 -1
  81. data/lib/puppet/type/file/owner.rb +8 -1
  82. data/lib/puppet/type/group.rb +0 -1
  83. data/lib/puppet/type/resources.rb +1 -1
  84. data/lib/puppet/type/service.rb +8 -3
  85. data/lib/puppet/type/user.rb +40 -39
  86. data/lib/puppet/util/autoload.rb +1 -1
  87. data/lib/puppet/util/command_line.rb +1 -1
  88. data/lib/puppet/util/filetype.rb +2 -2
  89. data/lib/puppet/util/json.rb +20 -0
  90. data/lib/puppet/util/log.rb +8 -4
  91. data/lib/puppet/util/logging.rb +1 -25
  92. data/lib/puppet/util/monkey_patches.rb +26 -2
  93. data/lib/puppet/util/package.rb +25 -16
  94. data/lib/puppet/util/pidlock.rb +1 -1
  95. data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +1 -1
  96. data/lib/puppet/util/suidmanager.rb +1 -2
  97. data/lib/puppet/util/tagging.rb +1 -0
  98. data/lib/puppet/util/windows/service.rb +0 -5
  99. data/lib/puppet/util/windows/user.rb +0 -1
  100. data/lib/puppet/util/windows.rb +3 -0
  101. data/lib/puppet/util/yaml.rb +11 -0
  102. data/lib/puppet/util.rb +4 -3
  103. data/lib/puppet/version.rb +1 -1
  104. data/lib/puppet.rb +3 -6
  105. data/locales/puppet.pot +265 -239
  106. data/man/man5/puppet.conf.5 +18 -2
  107. data/man/man8/puppet-agent.8 +4 -1
  108. data/man/man8/puppet-apply.8 +1 -1
  109. data/man/man8/puppet-catalog.8 +1 -1
  110. data/man/man8/puppet-config.8 +1 -1
  111. data/man/man8/puppet-describe.8 +1 -1
  112. data/man/man8/puppet-device.8 +1 -1
  113. data/man/man8/puppet-doc.8 +1 -1
  114. data/man/man8/puppet-epp.8 +1 -1
  115. data/man/man8/puppet-facts.8 +1 -1
  116. data/man/man8/puppet-filebucket.8 +1 -1
  117. data/man/man8/puppet-generate.8 +1 -1
  118. data/man/man8/puppet-help.8 +1 -1
  119. data/man/man8/puppet-lookup.8 +9 -6
  120. data/man/man8/puppet-module.8 +1 -1
  121. data/man/man8/puppet-node.8 +1 -1
  122. data/man/man8/puppet-parser.8 +1 -1
  123. data/man/man8/puppet-plugin.8 +1 -1
  124. data/man/man8/puppet-report.8 +1 -1
  125. data/man/man8/puppet-resource.8 +1 -1
  126. data/man/man8/puppet-script.8 +1 -1
  127. data/man/man8/puppet-ssl.8 +1 -1
  128. data/man/man8/puppet.8 +2 -2
  129. data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +2 -1
  130. data/spec/fixtures/unit/forge/bacula.json +1 -1
  131. data/spec/integration/application/agent_spec.rb +44 -0
  132. data/spec/integration/application/lookup_spec.rb +29 -6
  133. data/spec/integration/configurer_spec.rb +1 -1
  134. data/spec/integration/indirector/facts/facter_spec.rb +3 -3
  135. data/spec/integration/parser/pcore_resource_spec.rb +20 -0
  136. data/spec/integration/transaction/report_spec.rb +1 -1
  137. data/spec/integration/type/file_spec.rb +2 -2
  138. data/spec/integration/type/package_spec.rb +6 -6
  139. data/spec/integration/util/rdoc/parser_spec.rb +1 -1
  140. data/spec/integration/util/windows/process_spec.rb +1 -9
  141. data/spec/shared_contexts/l10n.rb +5 -0
  142. data/spec/unit/application/apply_spec.rb +76 -56
  143. data/spec/unit/application/lookup_spec.rb +131 -10
  144. data/spec/unit/application/resource_spec.rb +29 -0
  145. data/spec/unit/concurrent/thread_local_singleton_spec.rb +39 -0
  146. data/spec/unit/configurer_spec.rb +113 -28
  147. data/spec/unit/facter_impl_spec.rb +31 -0
  148. data/spec/unit/file_bucket/dipper_spec.rb +2 -2
  149. data/spec/unit/file_system/uniquefile_spec.rb +7 -1
  150. data/spec/unit/file_system_spec.rb +41 -4
  151. data/spec/unit/forge/module_release_spec.rb +3 -3
  152. data/spec/unit/functions/lookup_spec.rb +64 -0
  153. data/spec/unit/functions/versioncmp_spec.rb +40 -4
  154. data/spec/unit/http/client_spec.rb +58 -1
  155. data/spec/unit/indirector/indirection_spec.rb +10 -3
  156. data/spec/unit/network/formats_spec.rb +6 -0
  157. data/spec/unit/pops/parser/parse_containers_spec.rb +2 -2
  158. data/spec/unit/pops/serialization/to_from_hr_spec.rb +0 -58
  159. data/spec/unit/pops/serialization/to_stringified_spec.rb +5 -0
  160. data/spec/unit/pops/types/type_calculator_spec.rb +6 -0
  161. data/spec/unit/pops/validator/validator_spec.rb +5 -0
  162. data/spec/unit/provider/package/gem_spec.rb +1 -1
  163. data/spec/unit/provider/package/pip2_spec.rb +1 -1
  164. data/spec/unit/provider/package/pip3_spec.rb +1 -1
  165. data/spec/unit/provider/package/pip_spec.rb +1 -1
  166. data/spec/unit/provider/package/pkg_spec.rb +15 -0
  167. data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
  168. data/spec/unit/provider/package/puppetserver_gem_spec.rb +1 -1
  169. data/spec/unit/provider/service/gentoo_spec.rb +6 -5
  170. data/spec/unit/provider/service/init_spec.rb +15 -9
  171. data/spec/unit/provider/service/openwrt_spec.rb +21 -29
  172. data/spec/unit/provider/service/redhat_spec.rb +3 -2
  173. data/spec/unit/provider/user/aix_spec.rb +100 -0
  174. data/spec/unit/provider/user/directoryservice_spec.rb +1 -1
  175. data/spec/unit/provider/user/useradd_spec.rb +40 -0
  176. data/spec/unit/provider_spec.rb +4 -4
  177. data/spec/unit/puppet_spec.rb +12 -4
  178. data/spec/unit/resource/catalog_spec.rb +14 -1
  179. data/spec/unit/resource_spec.rb +58 -2
  180. data/spec/unit/settings/file_setting_spec.rb +10 -7
  181. data/spec/unit/transaction/persistence_spec.rb +51 -0
  182. data/spec/unit/type/file/group_spec.rb +7 -0
  183. data/spec/unit/type/file/owner_spec.rb +7 -0
  184. data/spec/unit/type/service_spec.rb +27 -0
  185. data/spec/unit/type/user_spec.rb +0 -45
  186. data/spec/unit/type_spec.rb +2 -2
  187. data/spec/unit/util/autoload_spec.rb +25 -8
  188. data/spec/unit/util/json_spec.rb +126 -0
  189. data/spec/unit/util/logging_spec.rb +2 -0
  190. data/spec/unit/util/yaml_spec.rb +37 -13
  191. data/tasks/parallel.rake +3 -3
  192. metadata +17 -4
@@ -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)
@@ -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
- raise Puppet::DevError, _("Invalid loglevel %{level}") % { level: level } unless @levels.include?(level)
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 = @levels.index(level)
112
+ return if @loglevel == loglevel
113
+
114
+ # loglevel changed
115
+ @loglevel = loglevel
112
116
 
113
117
  # Enable or disable Facter debugging
114
- Facter.debugging(level == :debug) if Facter.respond_to? :debugging
118
+ Puppet.runtime[:facter].debugging(level == :debug)
115
119
  end
116
120
 
117
121
  def Log.levels
@@ -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
- # Only recent versions of Facter support this feature
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.const_defined?(:V_ERR_HOSTNAME_MISMATCH)
87
- OpenSSL::X509.const_set(:V_ERR_HOSTNAME_MISMATCH, 62)
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
@@ -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( a == b ) then next
12
- elsif (a == '-' && b == '-') then next
13
- elsif (a == '-') then return -1
14
- elsif (b == '-') then return 1
15
- elsif (a == '.' && b == '.') then next
16
- elsif (a == '.' ) then return -1
17
- elsif (b == '.' ) then return 1
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
@@ -46,7 +46,7 @@ class Puppet::Util::Pidlock
46
46
  private
47
47
 
48
48
  def ps_argument_for_current_kernel
49
- case Facter.value(:kernel)
49
+ case Puppet.runtime[:facter].value(:kernel)
50
50
  when "Linux"
51
51
  "-eq"
52
52
  when "AIX"
@@ -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 = Facter.value('macosx_productversion_major') || false
20
+ @osx_maj_ver = Puppet.runtime[:facter].value('macosx_productversion_major') || false
22
21
  end
23
22
  module_function :osx_maj_ver
24
23
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative '../../puppet/util/tag_set'
2
3
 
3
4
  module Puppet::Util::Tagging
@@ -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
@@ -1,6 +1,5 @@
1
1
  require_relative '../../../puppet/util/windows'
2
2
 
3
- require 'facter'
4
3
  require 'ffi'
5
4
 
6
5
  module Puppet::Util::Windows::User
@@ -10,6 +10,9 @@ module Puppet::Util::Windows
10
10
  module File; end
11
11
  module Registry
12
12
  end
13
+ module Service
14
+ DEFAULT_TIMEOUT = 30
15
+ end
13
16
  module SID
14
17
  class Principal; end
15
18
  end
@@ -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 Facter.respond_to? :load_external
775
+ return yield unless Puppet.runtime[:facter].load_external?
776
+
776
777
  begin
777
- Facter.load_external(false)
778
+ Puppet.runtime[:facter].load_external(false)
778
779
  yield
779
780
  ensure
780
- Facter.load_external(true)
781
+ Puppet.runtime[:facter].load_external(true)
781
782
  end
782
783
  end
783
784
  module_function :skip_external_facts
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
 
8
8
  module Puppet
9
- PUPPETVERSION = '7.10.0'
9
+ PUPPETVERSION = '7.13.1'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and
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
- Facter.add(:puppetversion) do
192
+ Puppet.runtime[:facter].add(:puppetversion) do
197
193
  setcode { Puppet.version.to_s }
198
194
  end
199
195
 
200
- Facter.add(:agent_specified_environment) do
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'