puppet 6.4.4-x64-mingw32 → 6.4.5-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +1 -1
  3. data/Gemfile +4 -4
  4. data/Gemfile.lock +38 -32
  5. data/ext/build_defaults.yaml +1 -0
  6. data/ext/cert_inspector +3 -3
  7. data/ext/puppet-test +2 -2
  8. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  9. data/ext/windows/service/daemon.rb +38 -8
  10. data/install.rb +6 -6
  11. data/lib/puppet/application.rb +1 -1
  12. data/lib/puppet/application/apply.rb +2 -2
  13. data/lib/puppet/application/describe.rb +3 -9
  14. data/lib/puppet/application/doc.rb +1 -1
  15. data/lib/puppet/application/lookup.rb +1 -1
  16. data/lib/puppet/application/script.rb +2 -2
  17. data/lib/puppet/application/ssl.rb +4 -1
  18. data/lib/puppet/configurer.rb +86 -30
  19. data/lib/puppet/configurer/downloader.rb +2 -6
  20. data/lib/puppet/defaults.rb +32 -6
  21. data/lib/puppet/error.rb +9 -1
  22. data/lib/puppet/face/module/list.rb +5 -5
  23. data/lib/puppet/face/module/search.rb +1 -1
  24. data/lib/puppet/face/module/uninstall.rb +1 -1
  25. data/lib/puppet/face/module/upgrade.rb +1 -1
  26. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  27. data/lib/puppet/file_system.rb +0 -8
  28. data/lib/puppet/file_system/memory_file.rb +1 -1
  29. data/lib/puppet/file_system/posix.rb +3 -2
  30. data/lib/puppet/forge.rb +3 -3
  31. data/lib/puppet/functions.rb +1 -2
  32. data/lib/puppet/functions/camelcase.rb +2 -2
  33. data/lib/puppet/functions/epp.rb +4 -4
  34. data/lib/puppet/functions/find_file.rb +9 -9
  35. data/lib/puppet/functions/inline_epp.rb +5 -5
  36. data/lib/puppet/gettext/module_translations.rb +1 -1
  37. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  38. data/lib/puppet/graph/simple_graph.rb +4 -3
  39. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  40. data/lib/puppet/indirector/hiera.rb +2 -0
  41. data/lib/puppet/indirector/resource/ral.rb +1 -3
  42. data/lib/puppet/indirector/resource/validator.rb +1 -1
  43. data/lib/puppet/interface.rb +2 -1
  44. data/lib/puppet/loaders.rb +0 -1
  45. data/lib/puppet/metatype/manager.rb +1 -1
  46. data/lib/puppet/module.rb +1 -1
  47. data/lib/puppet/module/task.rb +20 -4
  48. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  49. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  50. data/lib/puppet/module_tool/metadata.rb +1 -1
  51. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  52. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  53. data/lib/puppet/network/http/api/indirected_routes.rb +12 -11
  54. data/lib/puppet/network/http/connection.rb +10 -12
  55. data/lib/puppet/network/http/pool.rb +2 -0
  56. data/lib/puppet/network/http/site.rb +1 -1
  57. data/lib/puppet/network/resolver.rb +2 -2
  58. data/lib/puppet/node/environment.rb +4 -2
  59. data/lib/puppet/pal/pal_impl.rb +2 -2
  60. data/lib/puppet/parser/ast.rb +1 -1
  61. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  62. data/lib/puppet/parser/functions.rb +1 -1
  63. data/lib/puppet/parser/functions/epp.rb +3 -3
  64. data/lib/puppet/parser/functions/inline_epp.rb +5 -5
  65. data/lib/puppet/parser/scope.rb +8 -7
  66. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  67. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  68. data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
  69. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  70. data/lib/puppet/pops/loader/task_instantiator.rb +4 -0
  71. data/lib/puppet/pops/loaders.rb +1 -1
  72. data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
  73. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  74. data/lib/puppet/pops/merge_strategy.rb +22 -18
  75. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  76. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  77. data/lib/puppet/pops/parser/locator.rb +1 -1
  78. data/lib/puppet/pops/parser/pn_parser.rb +17 -16
  79. data/lib/puppet/pops/puppet_stack.rb +51 -49
  80. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  81. data/lib/puppet/pops/types/string_converter.rb +10 -10
  82. data/lib/puppet/pops/types/types.rb +3 -3
  83. data/lib/puppet/property.rb +1 -1
  84. data/lib/puppet/property/ensure.rb +1 -1
  85. data/lib/puppet/provider/exec.rb +6 -2
  86. data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
  87. data/lib/puppet/provider/nameservice/pw.rb +2 -2
  88. data/lib/puppet/provider/package/apt.rb +5 -1
  89. data/lib/puppet/provider/package/dnfmodule.rb +87 -0
  90. data/lib/puppet/provider/package/dpkg.rb +34 -18
  91. data/lib/puppet/provider/package/openbsd.rb +1 -1
  92. data/lib/puppet/provider/package/pip.rb +34 -9
  93. data/lib/puppet/provider/package/portage.rb +4 -4
  94. data/lib/puppet/provider/package/rpm.rb +5 -5
  95. data/lib/puppet/provider/package/windows/package.rb +1 -1
  96. data/lib/puppet/provider/package/yum.rb +1 -1
  97. data/lib/puppet/provider/package_targetable.rb +5 -4
  98. data/lib/puppet/provider/parsedfile.rb +1 -1
  99. data/lib/puppet/provider/service/daemontools.rb +9 -9
  100. data/lib/puppet/provider/service/openbsd.rb +1 -1
  101. data/lib/puppet/provider/service/rcng.rb +2 -2
  102. data/lib/puppet/provider/service/runit.rb +2 -8
  103. data/lib/puppet/provider/service/systemd.rb +9 -9
  104. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  105. data/lib/puppet/provider/user/hpux.rb +1 -1
  106. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  107. data/lib/puppet/provider/user/useradd.rb +22 -13
  108. data/lib/puppet/provider/user/windows_adsi.rb +4 -5
  109. data/lib/puppet/reference/indirection.rb +2 -2
  110. data/lib/puppet/reference/metaparameter.rb +1 -3
  111. data/lib/puppet/reference/providers.rb +1 -3
  112. data/lib/puppet/reference/type.rb +3 -9
  113. data/lib/puppet/reports.rb +1 -1
  114. data/lib/puppet/resource.rb +1 -1
  115. data/lib/puppet/resource/catalog.rb +1 -1
  116. data/lib/puppet/settings.rb +3 -3
  117. data/lib/puppet/settings/environment_conf.rb +1 -0
  118. data/lib/puppet/ssl/host.rb +1 -1
  119. data/lib/puppet/ssl/oids.rb +1 -1
  120. data/lib/puppet/transaction.rb +33 -11
  121. data/lib/puppet/transaction/report.rb +1 -1
  122. data/lib/puppet/type.rb +2 -4
  123. data/lib/puppet/type/exec.rb +7 -3
  124. data/lib/puppet/type/file.rb +1 -2
  125. data/lib/puppet/type/file/data_sync.rb +5 -1
  126. data/lib/puppet/type/group.rb +4 -2
  127. data/lib/puppet/type/notify.rb +3 -2
  128. data/lib/puppet/type/package.rb +10 -3
  129. data/lib/puppet/type/schedule.rb +1 -1
  130. data/lib/puppet/type/service.rb +1 -1
  131. data/lib/puppet/type/user.rb +4 -2
  132. data/lib/puppet/util.rb +35 -12
  133. data/lib/puppet/util/command_line/trollop.rb +1 -1
  134. data/lib/puppet/util/http_proxy.rb +8 -14
  135. data/lib/puppet/util/log.rb +2 -2
  136. data/lib/puppet/util/log/destinations.rb +2 -2
  137. data/lib/puppet/util/logging.rb +32 -20
  138. data/lib/puppet/util/metric.rb +2 -2
  139. data/lib/puppet/util/provider_features.rb +2 -4
  140. data/lib/puppet/util/rdoc.rb +1 -1
  141. data/lib/puppet/util/reference.rb +1 -1
  142. data/lib/puppet/util/resource_template.rb +1 -1
  143. data/lib/puppet/util/selinux.rb +3 -1
  144. data/lib/puppet/util/windows/adsi.rb +48 -18
  145. data/lib/puppet/util/windows/registry.rb +7 -5
  146. data/lib/puppet/vendor.rb +1 -1
  147. data/lib/puppet/version.rb +1 -1
  148. data/lib/puppet/x509/cert_provider.rb +13 -6
  149. data/locales/puppet.pot +199 -159
  150. data/man/man5/puppet.conf.5 +35 -5
  151. data/man/man8/puppet-agent.8 +1 -1
  152. data/man/man8/puppet-apply.8 +1 -1
  153. data/man/man8/puppet-catalog.8 +1 -1
  154. data/man/man8/puppet-config.8 +1 -1
  155. data/man/man8/puppet-describe.8 +1 -1
  156. data/man/man8/puppet-device.8 +1 -1
  157. data/man/man8/puppet-doc.8 +1 -1
  158. data/man/man8/puppet-epp.8 +1 -1
  159. data/man/man8/puppet-facts.8 +1 -1
  160. data/man/man8/puppet-filebucket.8 +1 -1
  161. data/man/man8/puppet-generate.8 +1 -1
  162. data/man/man8/puppet-help.8 +1 -1
  163. data/man/man8/puppet-key.8 +1 -1
  164. data/man/man8/puppet-lookup.8 +1 -1
  165. data/man/man8/puppet-man.8 +1 -1
  166. data/man/man8/puppet-module.8 +1 -1
  167. data/man/man8/puppet-node.8 +1 -1
  168. data/man/man8/puppet-parser.8 +1 -1
  169. data/man/man8/puppet-plugin.8 +1 -1
  170. data/man/man8/puppet-report.8 +1 -1
  171. data/man/man8/puppet-resource.8 +1 -1
  172. data/man/man8/puppet-script.8 +1 -1
  173. data/man/man8/puppet-ssl.8 +1 -1
  174. data/man/man8/puppet-status.8 +1 -1
  175. data/man/man8/puppet.8 +2 -2
  176. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +11 -0
  177. data/spec/integration/configurer_spec.rb +52 -0
  178. data/spec/integration/type/notify_spec.rb +46 -0
  179. data/spec/lib/puppet/certificate_factory.rb +2 -2
  180. data/spec/spec_helper.rb +28 -0
  181. data/spec/unit/application/ssl_spec.rb +4 -7
  182. data/spec/unit/configurer_spec.rb +394 -398
  183. data/spec/unit/defaults_spec.rb +4 -4
  184. data/spec/unit/forge/forge_spec.rb +1 -3
  185. data/spec/unit/forge/repository_spec.rb +1 -3
  186. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  187. data/spec/unit/network/http/connection_spec.rb +119 -145
  188. data/spec/unit/parser/scope_spec.rb +10 -0
  189. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
  190. data/spec/unit/pops/loaders/module_loaders_spec.rb +37 -0
  191. data/spec/unit/provider/exec_spec.rb +209 -0
  192. data/spec/unit/provider/package/dnfmodule_spec.rb +186 -0
  193. data/spec/unit/provider/package/dpkg_spec.rb +238 -78
  194. data/spec/unit/provider/package/pip_spec.rb +51 -6
  195. data/spec/unit/provider/package/portage_spec.rb +4 -4
  196. data/spec/unit/provider/package_targetable_spec.rb +60 -0
  197. data/spec/unit/provider/service/daemontools_spec.rb +24 -0
  198. data/spec/unit/provider/service/runit_spec.rb +24 -0
  199. data/spec/unit/provider/service/systemd_spec.rb +25 -25
  200. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  201. data/spec/unit/provider/user/useradd_spec.rb +46 -0
  202. data/spec/unit/ssl/host_spec.rb +0 -5
  203. data/spec/unit/ssl/state_machine_spec.rb +0 -6
  204. data/spec/unit/transaction_spec.rb +46 -0
  205. data/spec/unit/type/exec_spec.rb +6 -12
  206. data/spec/unit/type/file/content_spec.rb +9 -3
  207. data/spec/unit/type/file_spec.rb +9 -4
  208. data/spec/unit/type/package_spec.rb +5 -0
  209. data/spec/unit/util/execution_spec.rb +16 -0
  210. data/spec/unit/util/http_proxy_spec.rb +118 -27
  211. data/spec/unit/util/log/destinations_spec.rb +7 -3
  212. data/spec/unit/util/log_spec.rb +0 -138
  213. data/spec/unit/util/logging_spec.rb +200 -0
  214. data/spec/unit/util/windows/adsi_spec.rb +51 -0
  215. data/spec/unit/x509/cert_provider_spec.rb +24 -4
  216. data/tasks/manpages.rake +1 -0
  217. metadata +12 -10
  218. data/lib/puppet/pops/loader/null_loader.rb +0 -60
  219. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +0 -24
  220. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +0 -24
  221. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +0 -24
@@ -155,7 +155,7 @@ HELP
155
155
  with_contents = options[:references].length <= 1
156
156
  exit_code = 0
157
157
  require 'puppet/util/reference'
158
- options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name|
158
+ options[:references].sort_by(&:to_s).each do |name|
159
159
  raise _("Could not find reference %{name}") % { name: name } unless section = Puppet::Util::Reference.reference(name)
160
160
 
161
161
  begin
@@ -283,7 +283,7 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
283
283
  'merge_hash_arrays' => !options[:merge_hash_arrays].nil?}
284
284
 
285
285
  if options[:prefix]
286
- merge_options.merge!({'knockout_prefix' => options[:prefix]})
286
+ merge_options['knockout_prefix'] = options[:prefix]
287
287
  end
288
288
 
289
289
  else
@@ -212,8 +212,8 @@ Copyright (c) 2017 Puppet Inc., LLC Licensed under the Apache 2.0 License
212
212
 
213
213
  compiler.compile()
214
214
 
215
- rescue Puppet::ParseErrorWithIssue, Puppet::Error
216
- # already logged and handled by the compiler for these two cases
215
+ rescue Puppet::Error
216
+ # already logged and handled by the compiler, including Puppet::ParseErrorWithIssue
217
217
  exit(1)
218
218
  end
219
219
 
@@ -249,7 +249,10 @@ END
249
249
  'certificate' => Puppet[:hostcert],
250
250
  'private key password file' => Puppet[:passfile]
251
251
  }
252
- paths.merge!('local CA certificate' => Puppet[:localcacert], 'local CRL' => Puppet[:hostcrl]) if options[:localca]
252
+ if options[:localca]
253
+ paths['local CA certificate'] = Puppet[:localcacert]
254
+ paths['local CRL'] = Puppet[:hostcrl]
255
+ end
253
256
  paths.each_pair do |label, path|
254
257
  if Puppet::FileSystem.exist?(path)
255
258
  Puppet::FileSystem.unlink(path)
@@ -148,9 +148,10 @@ class Puppet::Configurer
148
148
  facts_hash
149
149
  end
150
150
 
151
- def prepare_and_retrieve_catalog(options, query_options)
151
+ def prepare_and_retrieve_catalog(cached_catalog, options, query_options)
152
152
  # set report host name now that we have the fact
153
153
  options[:report].host = Puppet[:node_name_value]
154
+
154
155
  query_options[:transaction_uuid] = @transaction_uuid
155
156
  query_options[:job_id] = @job_id
156
157
  query_options[:static_catalog] = @static_catalog
@@ -160,26 +161,19 @@ class Puppet::Configurer
160
161
  query_options[:checksum_type] = @checksum_type.join('.')
161
162
 
162
163
  # apply passes in ral catalog
163
- catalog = options.delete(:catalog)
164
- return catalog if catalog
165
-
166
- # retrieve_catalog returns json catalog
167
- catalog = retrieve_catalog(query_options)
168
- return convert_catalog(catalog, @duration, options) if catalog
169
-
170
- Puppet.err _("Could not retrieve catalog; skipping run")
171
- nil
164
+ catalog = cached_catalog || options[:catalog]
165
+ unless catalog
166
+ # retrieve_catalog returns resource catalog
167
+ catalog = retrieve_catalog(query_options)
168
+ Puppet.err _("Could not retrieve catalog; skipping run") unless catalog
169
+ end
170
+ catalog
172
171
  end
173
172
 
174
173
  def prepare_and_retrieve_catalog_from_cache(options = {})
175
174
  result = retrieve_catalog_from_cache({:transaction_uuid => @transaction_uuid, :static_catalog => @static_catalog})
176
- if result
177
- Puppet.info _("Using cached catalog from environment '%{catalog_env}'") % { catalog_env: result.environment }
178
- # get facts now so that the convert_catalog method can resolve deferred values
179
- get_facts(options)
180
- return convert_catalog(result, @duration, options)
181
- end
182
- nil
175
+ Puppet.info _("Using cached catalog from environment '%{catalog_env}'") % { catalog_env: result.environment } if result
176
+ result
183
177
  end
184
178
 
185
179
  # Apply supplied catalog and return associated application report
@@ -257,13 +251,12 @@ class Puppet::Configurer
257
251
  Puppet::GettextConfig.reset_text_domain('agent')
258
252
  Puppet::ModuleTranslations.load_from_vardir(Puppet[:vardir])
259
253
 
260
- if catalog = prepare_and_retrieve_catalog_from_cache(options)
261
- options[:catalog] = catalog
254
+ if cached_catalog = prepare_and_retrieve_catalog_from_cache(options)
262
255
  @cached_catalog_status = 'explicitly_requested'
263
256
 
264
- if @environment != catalog.environment && !Puppet[:strict_environment_mode]
265
- Puppet.notice _("Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'.") % { local_env: @environment, catalog_env: catalog.environment }
266
- @environment = catalog.environment
257
+ if @environment != cached_catalog.environment && !Puppet[:strict_environment_mode]
258
+ Puppet.notice _("Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'.") % { local_env: @environment, catalog_env: cached_catalog.environment }
259
+ @environment = cached_catalog.environment
267
260
  end
268
261
 
269
262
  report.environment = @environment
@@ -284,7 +277,7 @@ class Puppet::Configurer
284
277
  configured_environment = Puppet[:environment] if Puppet.settings.set_by_config?(:environment)
285
278
 
286
279
  # We only need to find out the environment to run in if we don't already have a catalog
287
- unless (options[:catalog] || Puppet[:strict_environment_mode])
280
+ unless (cached_catalog || options[:catalog] || Puppet[:strict_environment_mode])
288
281
  begin
289
282
  node = nil
290
283
  node_retr_time = thinmark do
@@ -339,7 +332,7 @@ class Puppet::Configurer
339
332
  query_options[:configured_environment] = configured_environment
340
333
  options[:convert_for_node] = node
341
334
 
342
- unless catalog = prepare_and_retrieve_catalog(options, query_options)
335
+ unless catalog = prepare_and_retrieve_catalog(cached_catalog, options, query_options)
343
336
  return nil
344
337
  end
345
338
 
@@ -364,16 +357,37 @@ class Puppet::Configurer
364
357
  query_options = get_facts(options)
365
358
  query_options[:configured_environment] = configured_environment
366
359
 
367
- return nil unless catalog = prepare_and_retrieve_catalog(options, query_options)
360
+ # if we get here, ignore the cached catalog
361
+ return nil unless catalog = prepare_and_retrieve_catalog(nil, options, query_options)
368
362
  tries += 1
369
363
  end
370
364
 
365
+ # now that environment has converged, convert resource catalog into ral catalog
366
+ # unless we were given a RAL catalog
367
+ if !cached_catalog && options[:catalog]
368
+ ral_catalog = options[:catalog]
369
+ else
370
+ # REMIND @duration is the time spent loading the last catalog, and doesn't
371
+ # account for things like we failed to download and fell back to the cache
372
+ ral_catalog = convert_catalog(catalog, @duration, options)
373
+
374
+ # If not noop, commit the cached resource catalog (not ral catalog). Ideally
375
+ # we'd just copy the downloaded response body, instead of serializing the
376
+ # in-memory catalog, but that's hard due to the indirector.
377
+ indirection = Puppet::Resource::Catalog.indirection
378
+ if !Puppet[:noop] && indirection.cache?
379
+ request = indirection.request(:save, nil, catalog, environment: Puppet::Node::Environment.remote(catalog.environment))
380
+ Puppet.info("Caching catalog for #{request.key}")
381
+ indirection.cache.save(request)
382
+ end
383
+ end
384
+
371
385
  execute_prerun_command or return nil
372
386
 
373
- options[:report].code_id = catalog.code_id
374
- options[:report].catalog_uuid = catalog.catalog_uuid
387
+ options[:report].code_id = ral_catalog.code_id
388
+ options[:report].catalog_uuid = ral_catalog.catalog_uuid
375
389
  options[:report].cached_catalog_status = @cached_catalog_status
376
- apply_catalog(catalog, options)
390
+ apply_catalog(ral_catalog, options)
377
391
  true
378
392
  rescue => detail
379
393
  Puppet.log_exception(detail, _("Failed to apply catalog: %{detail}") % { detail: detail })
@@ -382,6 +396,14 @@ class Puppet::Configurer
382
396
  execute_postrun_command or return nil
383
397
  end
384
398
  ensure
399
+ if Puppet[:resubmit_facts]
400
+ # TODO: Should mark the report as "failed" if an error occurs and
401
+ # resubmit_facts returns false. There is currently no API for this.
402
+ resubmit_facts_time = thinmark { resubmit_facts }
403
+
404
+ report.add_times(:resubmit_facts, resubmit_facts_time)
405
+ end
406
+
385
407
  report.cached_catalog_status ||= @cached_catalog_status
386
408
  report.add_times(:total, Time.now - start)
387
409
  report.finalize_report
@@ -429,6 +451,40 @@ class Puppet::Configurer
429
451
  Puppet.log_exception(detail, _("Could not save last run local report: %{detail}") % { detail: detail })
430
452
  end
431
453
 
454
+ # Submit updated facts to the Puppet Server
455
+ #
456
+ # This method will clear all current fact values, load a fresh set of
457
+ # fact data, and then submit it to the Puppet Server.
458
+ #
459
+ # @return [true] If fact submission succeeds.
460
+ # @return [false] If an exception is raised during fact generation or
461
+ # submission.
462
+ def resubmit_facts
463
+ ::Facter.clear
464
+ facts = find_facts
465
+
466
+ saved_fact_terminus = Puppet::Node::Facts.indirection.terminus_class
467
+ begin
468
+ Puppet::Node::Facts.indirection.terminus_class = :rest
469
+
470
+ server = Puppet::Node::Facts::Rest.server
471
+ Puppet.info(_("Uploading facts for %{node} to %{server}") % {
472
+ node: facts.name,
473
+ server: server})
474
+
475
+ Puppet::Node::Facts.indirection.save(facts, nil, :environment => Puppet::Node::Environment.remote(@environment))
476
+
477
+ return true
478
+ ensure
479
+ Puppet::Node::Facts.indirection.terminus_class = saved_fact_terminus
480
+ end
481
+ rescue => detail
482
+ Puppet.log_exception(detail, _("Failed to submit facts: %{detail}") %
483
+ { detail: detail })
484
+
485
+ return false
486
+ end
487
+
432
488
  private
433
489
 
434
490
  def execute_from_setting(setting)
@@ -467,8 +523,8 @@ class Puppet::Configurer
467
523
  Puppet[:node_name_value],
468
524
  query_options.merge(
469
525
  :ignore_cache => true,
470
- # We never want to update the cached Catalog if we're running in noop mode.
471
- :ignore_cache_save => Puppet[:noop],
526
+ # don't update cache until after environment converges
527
+ :ignore_cache_save => true,
472
528
  :environment => Puppet::Node::Environment.remote(@environment),
473
529
  :fail_on_404 => true
474
530
  )
@@ -55,12 +55,8 @@ class Puppet::Configurer::Downloader
55
55
  :noop => false
56
56
  }
57
57
  if !Puppet::Util::Platform.windows?
58
- defargs.merge!(
59
- {
60
- :owner => Process.uid,
61
- :group => Process.gid
62
- }
63
- )
58
+ defargs[:owner] = Process.uid
59
+ defargs[:group] = Process.gid
64
60
  end
65
61
  return defargs
66
62
  end
@@ -35,7 +35,7 @@ module Puppet
35
35
  def self.default_basemodulepath
36
36
  if Puppet::Util::Platform.windows?
37
37
  path = ['$codedir/modules']
38
- installdir = Facter.value(:env_windows_installdir)
38
+ installdir = ENV["FACTER_env_windows_installdir"]
39
39
  if installdir
40
40
  path << "#{installdir}/puppet/modules"
41
41
  end
@@ -47,7 +47,7 @@ module Puppet
47
47
 
48
48
  def self.default_vendormoduledir
49
49
  if Puppet::Util::Platform.windows?
50
- installdir = Facter.value(:env_windows_installdir)
50
+ installdir = ENV["FACTER_env_windows_installdir"]
51
51
  if installdir
52
52
  "#{installdir}\\puppet\\vendor_modules"
53
53
  else
@@ -154,6 +154,19 @@ module Puppet
154
154
  end
155
155
  end
156
156
  },
157
+ :merge_dependency_warnings => {
158
+ :default => false,
159
+ :type => :boolean,
160
+ :desc => "Whether to merge class-level dependency failure warnings.
161
+
162
+ When a class has a failed dependency, every resource in the class
163
+ generates a notice level message about the dependency failure,
164
+ and a warning level message about skipping the resource.
165
+
166
+ If true, all messages caused by a class dependency failure are merged
167
+ into one message associated with the class.
168
+ ",
169
+ },
157
170
  :strict => {
158
171
  :default => :warning,
159
172
  :type => :symbolic_enum,
@@ -206,12 +219,19 @@ module Puppet
206
219
  :trace => {
207
220
  :default => false,
208
221
  :type => :boolean,
209
- :desc => "Whether to print stack traces on some errors",
222
+ :desc => "Whether to print stack traces on some errors. Will print
223
+ internal Ruby stack trace interleaved with Puppet function frames.",
210
224
  :hook => proc do |value|
211
225
  # Enable or disable Facter's trace option too
212
226
  Facter.trace(value) if Facter.respond_to? :trace
213
227
  end
214
228
  },
229
+ :puppet_trace => {
230
+ :default => false,
231
+ :type => :boolean,
232
+ :desc => "Whether to print the Puppet stack trace on some errors.
233
+ This is a noop if `trace` is also set.",
234
+ },
215
235
  :profile => {
216
236
  :default => false,
217
237
  :type => :boolean,
@@ -546,9 +566,10 @@ module Puppet
546
566
  },
547
567
  :http_proxy_host => {
548
568
  :default => "none",
549
- :desc => "The HTTP proxy host to use for outgoing connections. Note: You
569
+ :desc => "The HTTP proxy host to use for outgoing connections. The proxy will be bypassed if
570
+ the server's hostname matches the NO_PROXY environment variable or `no_proxy` setting. Note: You
550
571
  may need to use a FQDN for the server hostname when using a proxy. Environment variable
551
- http_proxy or HTTP_PROXY will override this value",
572
+ http_proxy or HTTP_PROXY will override this value. ",
552
573
  },
553
574
  :http_proxy_port => {
554
575
  :default => 3128,
@@ -574,7 +595,7 @@ module Puppet
574
595
  },
575
596
  :no_proxy => {
576
597
  :default => "localhost, 127.0.0.1",
577
- :desc => "List of domain names that should not go through `http_proxy_host`. Environment variable no_proxy or NO_PROXY will override this value.",
598
+ :desc => "List of host or domain names that should not go through `http_proxy_host`. Environment variable no_proxy or NO_PROXY will override this value. Names can be specified as an FQDN `host.example.com`, wildcard `*.example.com`, dotted domain `.example.com`, or suffix `example.com`.",
578
599
  },
579
600
  :http_keepalive_timeout => {
580
601
  :default => "4s",
@@ -1660,6 +1681,11 @@ EOT
1660
1681
  :type => :boolean,
1661
1682
  :desc => "Whether to send reports after every transaction.",
1662
1683
  },
1684
+ :resubmit_facts => {
1685
+ :default => false,
1686
+ :type => :boolean,
1687
+ :desc => "Whether to send updated facts after every transaction.",
1688
+ },
1663
1689
  :lastrunfile => {
1664
1690
  :default => "$statedir/last_run_summary.yaml",
1665
1691
  :type => :file,
@@ -12,7 +12,7 @@ module Puppet
12
12
  # This module implements logging with a filename and line number. Use this
13
13
  # for errors that need to report a location in a non-ruby file that we
14
14
  # parse.
15
- attr_accessor :line, :file, :pos
15
+ attr_accessor :line, :file, :pos, :puppetstack
16
16
 
17
17
  # May be called with 3 arguments for message, file, line, and exception, or
18
18
  # 4 args including the position on the line.
@@ -22,10 +22,18 @@ module Puppet
22
22
  original = pos
23
23
  pos = nil
24
24
  end
25
+
25
26
  super(message, original)
27
+
26
28
  @file = file unless (file.is_a?(String) && file.empty?)
27
29
  @line = line
28
30
  @pos = pos
31
+
32
+ if original && original.respond_to?(:puppetstack)
33
+ @puppetstack = original.puppetstack
34
+ else
35
+ @puppetstack = Puppet::Pops::PuppetStack.stacktrace()
36
+ end
29
37
  end
30
38
 
31
39
  def to_s
@@ -123,10 +123,10 @@ Puppet::Face.define(:module, '1.0.0') do
123
123
  unmet_grouped.each do |type, deps|
124
124
  unless deps.empty?
125
125
  unmet_grouped[type].sort_by { |dep| dep[:name] }.each do |dep|
126
- dep_name = dep[:name].gsub('/', '-')
126
+ dep_name = dep[:name].tr('/', '-')
127
127
  installed_version = dep[:mod_details][:installed_version]
128
128
  version_constraint = dep[:version_constraint]
129
- parent_name = dep[:parent][:name].gsub('/', '-')
129
+ parent_name = dep[:parent][:name].tr('/', '-')
130
130
  parent_version = dep[:parent][:version]
131
131
 
132
132
  msg = _("'%{parent_name}' (%{parent_version}) requires '%{dependency_name}' (%{dependency_version})") % { parent_name: parent_name, parent_version: parent_version, dependency_name: dep_name, dependency_version: version_constraint }
@@ -146,7 +146,7 @@ Puppet::Face.define(:module, '1.0.0') do
146
146
  error_display_order.each do |type|
147
147
  unless @unmet_deps[type].empty?
148
148
  @unmet_deps[type].keys.sort.each do |dep|
149
- name = dep.gsub('/', '-')
149
+ name = dep.tr('/', '-')
150
150
  errors = @unmet_deps[type][dep][:errors]
151
151
  version = @unmet_deps[type][dep][:version]
152
152
 
@@ -214,7 +214,7 @@ Puppet::Face.define(:module, '1.0.0') do
214
214
  dep[:reason] == :missing
215
215
  end
216
216
  missing_deps.map do |mis_mod|
217
- str = "#{colorize(:bg_red, _('UNMET DEPENDENCY'))} #{mis_mod[:name].gsub('/', '-')} "
217
+ str = "#{colorize(:bg_red, _('UNMET DEPENDENCY'))} #{mis_mod[:name].tr('/', '-')} "
218
218
  str << "(#{colorize(:cyan, mis_mod[:version_constraint])})"
219
219
  node[:dependencies] << { :text => str }
220
220
  end
@@ -239,7 +239,7 @@ Puppet::Face.define(:module, '1.0.0') do
239
239
  #
240
240
  def list_build_node(mod, parent, params)
241
241
  str = ''
242
- str << (mod.forge_name ? mod.forge_name.gsub('/', '-') : mod.name)
242
+ str << (mod.forge_name ? mod.forge_name.tr('/', '-') : mod.name)
243
243
  str << ' (' + colorize(:cyan, mod.version ? "v#{mod.version}" : '???') + ')'
244
244
 
245
245
  unless File.dirname(mod.path) == params[:path]
@@ -81,7 +81,7 @@ Puppet::Face.define(:module, '1.0.0') do
81
81
 
82
82
  highlight = proc do |s|
83
83
  s = s.gsub(term, colorize(:green, term))
84
- s = s.gsub(term.gsub('/', '-'), colorize(:green, term.gsub('/', '-'))) if term =~ /\//
84
+ s = s.gsub(term.tr('/', '-'), colorize(:green, term.tr('/', '-'))) if term =~ /\//
85
85
  s = s.gsub(' DEPRECATED', colorize(:red, ' DEPRECATED'))
86
86
  s
87
87
  end
@@ -57,7 +57,7 @@ Puppet::Face.define(:module, '1.0.0') do
57
57
  end
58
58
 
59
59
  when_invoked do |name, options|
60
- name = name.gsub('/', '-')
60
+ name = name.tr('/', '-')
61
61
 
62
62
  Puppet::ModuleTool.set_option_defaults options
63
63
  message = if options[:version]
@@ -63,7 +63,7 @@ Puppet::Face.define(:module, '1.0.0') do
63
63
  end
64
64
 
65
65
  when_invoked do |name, options|
66
- name = name.gsub('/', '-')
66
+ name = name.tr('/', '-')
67
67
  Puppet.notice _("Preparing to upgrade '%{name}' ...") % { name: name }
68
68
  Puppet::ModuleTool.set_option_defaults options
69
69
  Puppet::ModuleTool::Applications::Upgrader.new(name, options).run
@@ -40,7 +40,7 @@ class Puppet::FileServing::HttpMetadata < Puppet::FileServing::Metadata
40
40
  [ @checksum_type, :md5, :sha256, :sha384, :sha512, :sha224, :mtime ].each do |type|
41
41
  @checksum_type = type
42
42
  @checksum = @checksums[type]
43
- return if @checksum
43
+ break if @checksum
44
44
  end
45
45
  end
46
46
  end
@@ -92,14 +92,6 @@ module Puppet::FileSystem
92
92
  @impl.path_string(@impl.basename(assert_path(path)))
93
93
  end
94
94
 
95
- # @return [Integer] the size of the file
96
- #
97
- # @api public
98
- #
99
- def self.size(path)
100
- @impl.size(assert_path(path))
101
- end
102
-
103
95
  # Allows exclusive updates to a file to be made by excluding concurrent
104
96
  # access using flock. This means that if the file is on a filesystem that
105
97
  # does not support flock, this method will provide no protection.